\input{preamble}

% OK, start here.
%
\begin{document}

\title{Quot and Hilbert Spaces}

\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents




\section{Introduction}
\label{section-introduction}

\noindent
As initially conceived, the purpose of this chapter was to write about
Quot and Hilbert functors and to prove that these are algebraic spaces
provided certain technical conditions are satisfied. This material, in
the setting of schemes, is
covered in Grothendieck's lectures in the s\'eminair Bourbaki, see
\cite{Gr-I},
\cite{Gr-II},
\cite{Gr-III},
\cite{Gr-IV},
\cite{Gr-V}, and
\cite{Gr-VI}. For projective schemes the Quot and Hilbert schemes
live inside Grassmannians of spaces of sections of suitable very
ample invertible sheaves, and this provides a method of construction
for these schemes. Our approach is different: we use Artin's axioms to
prove Quot and Hilb are algebraic spaces.

\medskip\noindent
Upon further consideration, it turned out to be more convenient for
the development of theory in the Stacks project, to start the
discussion with the stack $\Cohstack_{X/B}$
of coherent sheaves (with proper support over the base)
as introduced in \cite{lieblich_remarks}. For us $f : X \to B$
is a morphism of algebraic spaces satisfying suitable
technical conditions, although this can be generalized (see below).
Given modules $\mathcal{F}$ and $\mathcal{G}$
on $X$, under suitably hypotheses, the functor
$T/B \mapsto \Hom_{X_T}(\mathcal{F}_T, \mathcal{G}_T)$
is an algebraic space $\mathit{Hom}(\mathcal{F}, \mathcal{G})$
over $B$. See Section \ref{section-hom}. The subfunctor
$\mathit{Isom}(\mathcal{F}, \mathcal{G})$ of isomorphisms is
shown to be an algebraic space in Section \ref{section-isom}.
This is used in the next sections to show the diagonal of
the stack $\Cohstack_{X/B}$ is representable. We prove
$\Cohstack_{X/B}$ is an algebraic stack in
Section \ref{section-stack-coherent-sheaves} when $X \to B$ is flat
and in Section \ref{section-not-flat} in general.
Please see the introduction of this section for pointers
to the literature.

\medskip\noindent
Having proved this, it is rather straightforward to prove that
$\Quotfunctor_{\mathcal{F}/X/B}$, $\Hilbfunctor_{X/B}$, and
$\Picardfunctor_{X/B}$ are algebraic spaces and that
$\Picardstack_{X/B}$ is an algebraic stack. See
Sections \ref{section-quot}, \ref{section-hilb},
\ref{section-picard-functor}, and \ref{section-picard-stack}.

\medskip\noindent
In the usual manner we deduce that the functor $\mathit{Mor}_B(Z, X)$
of relative morphisms is an algebraic space (under suitable
hypotheses) in Section \ref{section-relative-morphisms}.

\medskip\noindent
In Section \ref{section-stack-of-spaces} we prove that the stack in
groupoids
$$
\Spacesstack'_{fp, flat, proper}
$$
parametrizing flat families of proper algebraic spaces satisfies all
of Artin's axioms (including openness of versality) except for
formal effectiveness. We've chosen the very awkward notation for
this stack intentionally, because the reader should be carefull
in using its properties.

\medskip\noindent
In Section \ref{section-polarized} we prove that the stack
$\Polarizedstack$
parametrizing flat families of polarized proper algebraic spaces
is an algebraic stack. Because of our work on flat families of proper
algebraic spaces, this comes down to proving
formal effectiveness for polarized schemes which is often known
as Grothendieck's algebraization theorem.

\medskip\noindent
In Section \ref{section-curves} we prove that the stack
$\Curvesstack$ parametrizing families of curves is algebraic.

\medskip\noindent
In Section \ref{section-moduli-complexes}
we study moduli of complexes on a proper morphism
and we obtain an algebraic stack $\Complexesstack_{X/B}$.
The idea of the statement and the proof are taken from
\cite{lieblich-complexes}.

\medskip\noindent
What is not in this chapter? There is almost no discussion of
the properties the resulting moduli spaces and moduli stacks
possess (beyond their algebraicity); to read about this we
refer to Moduli Stacks, Section \ref{moduli-section-introduction}.
In most of the results discussed, we can generalize the constructions
by considering a morphism $\mathcal{X} \to \mathcal{B}$ of algebraic
stacks instead of a morphism $X \to B$ of algebraic space.
We will discuss this (insert future reference here).
In the case of Hilbert spaces there is a more general notion of
``Hilbert stacks'' which we will discuss in a separate chapter, see
(insert future reference here).




\section{Conventions}
\label{section-conventions}

\noindent
We have intentionally placed this chapter, as well as the chapters
``Examples of Stacks'', ``Sheaves on Algebraic Stacks'',
``Criteria for Representability'', and ``Artin's Axioms'' before the
general development of the theory of algebraic stacks. The reason
for this is that starting with the next chapter (see
Properties of Stacks, Section \ref{stacks-properties-section-conventions})
we will no longer distinguish between a scheme and the algebraic stack
it gives rise to. Thus our language will become more flexible and
easier for a human to parse, but also less precise. These first few
chapters, including the initial chapter ``Algebraic Stacks'', lay the
groundwork that later allow us to ignore some of the very technical
distinctions between different ways of thinking about algebraic stacks.
But especially in the chapters ``Artin's Axioms'' and
``Criteria of Representability'' we need
to be very precise about what objects exactly we are working with, as
we are trying to show that certain constructions produce algebraic stacks or
algebraic spaces.

\medskip\noindent
Unfortunately, this means that some of the notation, conventions and
terminology is awkward and may seem backwards to the more experienced
reader. We hope the reader will forgive us!

\medskip\noindent
The standing assumption is that all schemes are contained in
a big fppf site $\Sch_{fppf}$. And all rings $A$ considered
have the property that $\Spec(A)$ is (isomorphic) to an
object of this big site.

\medskip\noindent
Let $S$ be a scheme and let $X$ be an algebraic space over $S$.
In this chapter and the following we will write $X \times_S X$
for the product of $X$ with itself (in the category of algebraic
spaces over $S$), instead of $X \times X$.















\section{The Hom functor}
\label{section-hom}

\noindent
In this section we study the functor of homomorphisms defined below.

\begin{situation}
\label{situation-hom}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$. Let $\mathcal{F}$, $\mathcal{G}$ be quasi-coherent
$\mathcal{O}_X$-modules. For any scheme $T$ over $B$ we will denote
$\mathcal{F}_T$ and $\mathcal{G}_T$ the base changes of
$\mathcal{F}$ and $\mathcal{G}$ to $T$, in other words, the pullbacks
via the projection morphism $X_T = X \times_B T \to X$.
We consider the functor
\begin{equation}
\label{equation-hom}
\mathit{Hom}(\mathcal{F}, \mathcal{G}) :
(\Sch/B)^{opp}
\longrightarrow
\textit{Sets},\quad
T
\longrightarrow
\Hom_{\mathcal{O}_{X_T}}(\mathcal{F}_T, \mathcal{G}_T)
\end{equation}
\end{situation}

\noindent
In Situation \ref{situation-hom} we sometimes think of
$\mathit{Hom}(\mathcal{F}, \mathcal{G})$ as a functor
$(\Sch/S)^{opp} \to \textit{Sets}$
endowed with a morphism
$\mathit{Hom}(\mathcal{F}, \mathcal{G}) \to B$.
Namely, if $T$ is a scheme over $S$, then an element of
$\mathit{Hom}(\mathcal{F}, \mathcal{G})(T)$ consists of a pair
$(h, u)$, where $h$ is a morphism $h : T \to B$ and
$u : \mathcal{F}_T \to \mathcal{G}_T$ is an $\mathcal{O}_{X_T}$-module
map where $X_T = T \times_{h, B} X$ and $\mathcal{F}_T$ and $\mathcal{G}_T$
are the pullbacks to $X_T$. In particular, when we say
that $\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is an algebraic space,
we mean that the corresponding functor
$(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\begin{lemma}
\label{lemma-hom-sheaf}
In Situation \ref{situation-hom} the functor
$\mathit{Hom}(\mathcal{F}, \mathcal{G})$ 
satisfies the sheaf property for the fpqc topology.
\end{lemma}

\begin{proof}
Let $\{T_i \to T\}_{i \in I}$ be an fpqc covering of schemes over $B$.
Set $X_i = X_{T_i} = X \times_S T_i$ and $\mathcal{F}_i = u_{T_i}$
and $\mathcal{G}_i = \mathcal{G}_{T_i}$.
Note that $\{X_i \to X_T\}_{i \in I}$ is an fpqc covering of $X_T$, see
Topologies on Spaces, Lemma \ref{spaces-topologies-lemma-fpqc}.
Thus a family of maps $u_i : \mathcal{F}_i \to \mathcal{G}_i$
such that $u_i$ and $u_j$ restrict to the same map on
$X_{T_i \times_T T_j}$ comes from a unique map
$u : \mathcal{F}_T \to \mathcal{G}_T$ by descent
(Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}).
\end{proof}

\noindent
Sanity check: $\mathit{Hom}$ sheaf plays the same role among algebraic spaces
over $S$.

\begin{lemma}
\label{lemma-extend-hom-to-spaces}
In Situation \ref{situation-hom}. Let $T$ be an algebraic space over $S$.
We have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T, \mathit{Hom}(\mathcal{F}, \mathcal{G})) =
\{(h, u) \mid h : T \to B, u : \mathcal{F}_T \to \mathcal{G}_T\}
$$
where $\mathcal{F}_T, \mathcal{G}_T$ denote the pullbacks of $\mathcal{F}$
and $\mathcal{G}$ to the algebraic space $X \times_{B, h} T$.
\end{lemma}

\begin{proof}
Choose a scheme $U$ and a surjective \'etale morphism $p : U \to T$.
Let $R = U \times_T U$ with projections $t, s : R \to U$.

\medskip\noindent
Let $v : T \to \mathit{Hom}(\mathcal{F}, \mathcal{G})$
be a natural transformation. Then $v(p)$ corresponds to a pair
$(h_U, u_U)$ over $U$. As $v$ is a transformation of functors we see
that the pullbacks of $(h_U, u_U)$ by $s$ and $t$ agree.
Since $T = U/R$ (Spaces, Lemma \ref{spaces-lemma-space-presentation}),
we obtain a morphism $h : T \to B$ such that
$h_U = h \circ p$. Then $\mathcal{F}_U$ is the pullback of
$\mathcal{F}_T$ to $X_U$ and similarly for $\mathcal{G}_U$.
Hence $u_U$ descends to a $\mathcal{O}_{X_T}$-module map
$u : \mathcal{F}_T \to \mathcal{G}_T$ by
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}.

\medskip\noindent
Conversely, let $(h, u)$ be a pair over $T$. Then we get a natural
transformation $v : T \to \mathit{Hom}(\mathcal{F}, \mathcal{G})$
by sending a morphism $a : T' \to T$ where $T'$ is a scheme
to $(h \circ a, a^*u)$. We omit the verification that the construction
of this and the previous paragraph are mutually inverse.
\end{proof}

\begin{remark}
\label{remark-hom-base-change}
In Situation \ref{situation-hom} let $B' \to B$ be a morphism of
algebraic spaces over $S$. Set $X' = X \times_B B'$ and denote
$\mathcal{F}'$, $\mathcal{G}'$ the pullback of
$\mathcal{F}$, $\mathcal{G}$ to $X'$. Then we obtain a functor
$\mathit{Hom}(\mathcal{F}', \mathcal{G}') : (\Sch/B')^{opp} \to \textit{Sets}$
associated to the base change $f' : X' \to B'$. For a scheme $T$ over $B'$
it is clear that we have
$$
\mathit{Hom}(\mathcal{F}', \mathcal{G}')(T) =
\mathit{Hom}(\mathcal{F}, \mathcal{G})(T)
$$
where on the right hand side we think of $T$ as a scheme over $B$
via the composition $T \to B' \to B$. This trivial remark
will occasionally be useful to change the base algebraic space.
\end{remark}

\begin{lemma}
\label{lemma-hom-sheaf-in-X}
In Situation \ref{situation-hom} let $\{X_i \to X\}_{i \in I}$ be an fppf
covering and for each $i, j \in I$ let $\{X_{ijk} \to X_i \times_X X_j\}$
be an fppf covering. Denote $\mathcal{F}_i$, resp.\ $\mathcal{F}_{ijk}$
the pullback of $\mathcal{F}$ to $X_i$, resp.\ $X_{ijk}$. Similarly
define $\mathcal{G}_i$ and $\mathcal{G}_{ijk}$. For every scheme
$T$ over $B$ the diagram
$$
\xymatrix{
\mathit{Hom}(\mathcal{F}, \mathcal{G})(T) \ar[r] &
\prod\nolimits_i
\mathit{Hom}(\mathcal{F}_i, \mathcal{G}_i)(T)
\ar@<1ex>[r]^-{\text{pr}_0^*} \ar@<-1ex>[r]_-{\text{pr}_1^*}
&
\prod\nolimits_{i, j, k}
\mathit{Hom}(\mathcal{F}_{ijk}, \mathcal{G}_{ijk})(T)
}
$$
presents the first arrow as the equalizer of the other two.
\end{lemma}

\begin{proof}
Let $u_i : \mathcal{F}_{i, T} \to \mathcal{G}_{i, T}$ be an element in the
equalizer of $\text{pr}_0^*$ and $\text{pr}_1^*$. Since the base change
of an fppf covering is an fppf covering
(Topologies on Spaces, Lemma \ref{spaces-topologies-lemma-fppf})
we see that $\{X_{i, T} \to X_T\}_{i \in I}$ and
$\{X_{ijk, T} \to X_{i, T} \times_{X_T} X_{j, T}\}$ are fppf coverings.
Applying Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
we first conclude that $u_i$ and $u_j$ restrict to the same morphism
over $X_{i, T} \times_{X_T} X_{j, T}$, whereupon a second application
shows that there is a unique morphism $u : \mathcal{F}_T \to \mathcal{G}_T$
restricting to $u_i$ for each $i$. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-hom-limits}
In Situation \ref{situation-hom}. If $\mathcal{F}$ is of finite presentation
and $f$ is quasi-compact and quasi-separated, then
$\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is limit preserving.
\end{lemma}

\begin{proof}
Let $T = \lim_{i \in I} T_i$ be a directed limit of affine $B$-schemes.
We have to show that
$$
\mathit{Hom}(\mathcal{F}, \mathcal{G})(T) =
\colim \mathit{Hom}(\mathcal{F}, \mathcal{G})(T_i)
$$
Pick $0 \in I$. We may replace $B$ by $T_0$, $X$ by $X_{T_0}$,
$\mathcal{F}$ by $\mathcal{F}_{T_0}$, $\mathcal{G}$ by
$\mathcal{G}_{T_0}$, and $I$ by $\{i \in I \mid i \geq 0\}$.
See Remark \ref{remark-hom-base-change}.
Thus we may assume $B = \Spec(R)$ is affine.

\medskip\noindent
When $B$ is affine, then $X$ is quasi-compact and quasi-separated.
Choose a surjective \'etale morphism $U \to X$ where $U$ is an
affine scheme (Properties of Spaces, Lemma
\ref{spaces-properties-lemma-quasi-compact-affine-cover}).
Since $X$ is quasi-separated, the scheme $U \times_X U$ is quasi-compact
and we may choose a surjective \'etale morphism $V \to U \times_X U$
where $V$ is an affine scheme. Applying Lemma \ref{lemma-hom-sheaf-in-X}
we see that $\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is the
equalizer of two maps between
$$
\mathit{Hom}(\mathcal{F}|_U, \mathcal{G}|_U)
\quad\text{and}\quad
\mathit{Hom}(\mathcal{F}|_V, \mathcal{G}|_V)
$$
This reduces us to the case that $X$ is affine.

\medskip\noindent
In the affine case the statement of the lemma reduces to
the following problem: Given a ring map $R \to A$, two $A$-modules
$M$, $N$ and a directed system of $R$-algebras $C = \colim C_i$.
When is it true that the map
$$
\colim \Hom_{A \otimes_R C_i}(M \otimes_R C_i, N \otimes_R C_i)
\longrightarrow
\Hom_{A \otimes_R C}(M \otimes_R C, N \otimes_R C)
$$
is bijective? By
Algebra, Lemma \ref{algebra-lemma-module-map-property-in-colimit}
this holds if $M \otimes_R C$ is of finite presentation over
$A \otimes_R C$, i.e., when $M$ is of finite presentation over $A$.
\end{proof}

\begin{lemma}
\label{lemma-hom-closed}
Let $S$ be a scheme. Let $B$ be an algebraic space over $S$.
Let $i : X' \to X$ be a closed immersion of algebraic spaces
over $B$. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module
and let $\mathcal{G}'$ be a quasi-coherent $\mathcal{O}_{X'}$-module.
Then
$$
\mathit{Hom}(\mathcal{F}, i_*\mathcal{G}') =
\mathit{Hom}(i^*\mathcal{F}, \mathcal{G}')
$$
as functors on $(\Sch/B)$.
\end{lemma}

\begin{proof}
Let $g : T \to B$ be a morphism where $T$ is a scheme.
Denote $i_T : X'_T \to X_T$ the base change of $i$.
Denote $h : X_T \to X$ and $h' : X'_T \to X'$ the projections.
Observe that $(h')^*i^*\mathcal{F} = i_T^*h^*\mathcal{F}$.
As a closed immersion is affine
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-closed-immersion-affine})
we have $h^*i_*\mathcal{G} = i_{T, *}(h')^*\mathcal{G}$ by
Cohomology of Spaces, Lemma \ref{spaces-cohomology-lemma-affine-base-change}.
Thus we have
\begin{align*}
\mathit{Hom}(\mathcal{F}, i_*\mathcal{G}')(T)
& =
\Hom_{\mathcal{O}_{X_T}}(h^*\mathcal{F}, h^*i_*\mathcal{G}') \\
& =
\Hom_{\mathcal{O}_{X_T}}(h^*\mathcal{F}, i_{T, *}(h')^*\mathcal{G}) \\
& =
\Hom_{\mathcal{O}_{X'_T}}(i_T^*h^*\mathcal{F}, (h')^*\mathcal{G}) \\
& =
\Hom_{\mathcal{O}_{X'_T}}((h')^*i^*\mathcal{F}, (h')^*\mathcal{G}) \\
& =
\mathit{Hom}(i^*\mathcal{F}, \mathcal{G}')(T)
\end{align*}
as desired. The middle equality follows from the adjointness of the functors
$i_{T, *}$ and $i_T^*$.
\end{proof}

\begin{lemma}
\label{lemma-cohomology-perfect-complex}
Let $S$ be a scheme. Let $B$ be an algebraic space over $S$.
Let $K$ be a pseudo-coherent object of $D(\mathcal{O}_B)$.
\begin{enumerate}
\item If for all $g : T \to B$ in $(\Sch/B)$ the cohomology sheaf
$H^{-1}(Lg^*K)$ is zero, then the functor
$$
(\Sch/B)^{opp} \longrightarrow \textit{Sets},\quad
(g : T \to B) \longmapsto H^0(T, H^0(Lg^*K))
$$
is an algebraic space affine and of finite presentation over $B$.
\item If for all $g : T \to B$ in $(\Sch/B)$ the cohomology sheaves
$H^i(Lg^*K)$ are zero for $i < 0$, then $K$ is perfect,
$K$ locally has tor amplitude in $[0, b]$, and the functor
$$
(\Sch/B)^{opp} \longrightarrow \textit{Sets},\quad
(g : T \to B) \longmapsto H^0(T, Lg^*K)
$$
is an algebraic space affine and of finite presentation over $B$.
\end{enumerate}
\end{lemma}

\begin{proof}
Under the assumptions of (2) we have $H^0(T, Lg^*K) = H^0(T, H^0(Lg^*K))$.
Let us prove that the rule $T \mapsto H^0(T, H^0(Lg^*K))$ satisfies the
sheaf property for the fppf topology. To do this assume we have an
fppf covering $\{h_i : T_i \to T\}$ of a scheme $g : T \to B$ over $B$.
Set $g_i = g \circ h_i$. Note that since $h_i$ is flat, we have
$Lh_i^* = h_i^*$ and $h_i^*$ commutes with taking cohomology. Hence
$$
H^0(T_i, H^0(Lg_i^*K)) =
H^0(T_i, H^0(h_i^*Lg^*K)) =
H^0(T, h_i^*H^0(Lg^*K))
$$
Similarly for the pullback to $T_i \times_T T_j$.
Since $Lg^*K$ is a pseudo-coherent complex on $T$
(Cohomology on Sites, Lemma
\ref{sites-cohomology-lemma-pseudo-coherent-pullback})
the cohomology sheaf $\mathcal{F} = H^0(Lg^*K)$ is quasi-coherent
(Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-pseudo-coherent}).
Hence by Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
we see that
$$
H^0(T, \mathcal{F}) = \Ker(
\prod H^0(T_i, h_i^*\mathcal{F}) \to
\prod H^0(T_i \times_T T_j, (T_i \times_T T_j \to T)^*\mathcal{F}))
$$
In this way we see that the rules in (1) and (2) satisfy
the sheaf property for fppf coverings. This means we may apply
Bootstrap, Lemma \ref{bootstrap-lemma-locally-algebraic-space-finite-type}
to see it suffices to prove the representability \'etale locally on $B$.
Moreover, we may check whether the end result is affine and
of finite presentation \'etale locally on $B$, see
Morphisms of Spaces, Lemmas \ref{spaces-morphisms-lemma-affine-local} and
\ref{spaces-morphisms-lemma-finite-presentation-local}.
Hence we may assume that $B$ is an affine scheme.

\medskip\noindent
Assume $B = \Spec(A)$ is an affine scheme. By the results of
Derived Categories of Spaces, Lemmas
\ref{spaces-perfect-lemma-pseudo-coherent},
\ref{spaces-perfect-lemma-derived-quasi-coherent-small-etale-site}, and
\ref{spaces-perfect-lemma-descend-pseudo-coherent}
we deduce that in the rest of the proof we may think of $K$ as a perfect
object of the derived category of complexes of modules on $B$
in the Zariski topology. By 
Derived Categories of Schemes, Lemmas
\ref{perfect-lemma-pseudo-coherent},
\ref{perfect-lemma-affine-compare-bounded}, and
\ref{perfect-lemma-pseudo-coherent-affine} we can find a pseudo-coherent
complex $M^\bullet$ of $A$-modules such that $K$ is the corresponding
object of $D(\mathcal{O}_B)$. Our assumption on pullbacks implies
that $M^\bullet \otimes^\mathbf{L}_A \kappa(\mathfrak p)$
has vanishing $H^{-1}$ for all primes $\mathfrak p \subset A$.
By More on Algebra, Lemma \ref{more-algebra-lemma-cut-complex-in-two}
we can write
$$
M^\bullet =
\tau_{\geq 0}M^\bullet \oplus \tau_{\leq - 1}M^\bullet
$$
with $\tau_{\geq 0}M^\bullet$ perfect with Tor amplitude in $[0, b]$
for some $b \geq 0$ (here we also have used
More on Algebra, Lemmas \ref{more-algebra-lemma-glue-perfect} and
\ref{more-algebra-lemma-glue-tor-amplitude}).
Note that in case (2) we also see that $\tau_{\leq - 1}M^\bullet = 0$
in $D(A)$ whence $M^\bullet$ and $K$ are perfect with
tor amplitude in $[0, b]$. For any $B$-scheme $g : T \to B$ we have
$$
H^0(T, H^0(Lg^*K)) = H^0(T, H^0(Lg^*\tau_{\geq 0}K))
$$
(by the dual of Derived Categories, Lemma
\ref{derived-lemma-negative-vanishing})
hence we may replace $K$ by $\tau_{\geq 0}K$ and correspondingly
$M^\bullet$ by $\tau_{\geq 0}M^\bullet$. In other words, we may
assume $M^\bullet$ has tor amplitude in $[0, b]$.

\medskip\noindent
Assume $M^\bullet$ has tor amplitude in $[0, b]$.
We may assume $M^\bullet$ is a bounded above complex of finite free
$A$-modules (by our definition of pseudo-coherent complexes, see
More on Algebra, Definition \ref{more-algebra-definition-pseudo-coherent}
and the discussion following the definition).
By More on Algebra, Lemma \ref{more-algebra-lemma-last-one-flat}
we see that $M = \Coker(M^{- 1} \to M^0)$ is flat. By
Algebra, Lemma \ref{algebra-lemma-finite-projective} we see that $M$
is finite locally free. Hence $M^\bullet$ is quasi-isomorphic to
$$
M \to M^1 \to M^2 \to \ldots \to M^d \to 0 \ldots
$$
Note that this is a K-flat complex
(Cohomology, Lemma \ref{cohomology-lemma-bounded-flat-K-flat}),
hence derived pullback of $K$ via a morphism $T \to B$ is computed
by the complex
$$
g^*\widetilde{M} \to g^*\widetilde{M^1} \to \ldots
$$
Thus it suffices to show that the functor
$$
(g : T \to B) \longmapsto
\Ker(
\Gamma(T,g^*\widetilde{M})
\to
\Gamma(T, g^*(\widetilde{M^1})
)
$$
is representable by an affine scheme of finite presentation over $B$.

\medskip\noindent
We may still replace $B$ by the members of an affine open covering
in order to prove this last statement. Hence we may assume that $M$
is finite free (recall that $M^1$ is finite free to begin with).
Write $M = A^{\oplus n}$ and $M^1 = A^{\oplus m}$. Let the map
$M \to M^1$ be given by the $m \times n$ matrix $(a_{ij})$ with
coefficients in $A$. Then $\widetilde{M} = \mathcal{O}_B^{\oplus n}$
and $\widetilde{M^1} = \mathcal{O}_B^{\oplus m}$. Thus the functor
above is equal to the functor
$$
(g : T \to B) \longmapsto
\{(f_1, \ldots, f_n) \in \Gamma(T, \mathcal{O}_T) \mid
\sum g^\sharp(a_{ij})f_i = 0,\ j = 1, \ldots, m\}
$$
Clearly this is representable by the affine scheme
$$
\Spec\left(A[x_1, \ldots, x_n]/(\sum a_{ij}x_i; j = 1, \ldots, m)\right)
$$
and the lemma has been proved.
\end{proof}

\noindent
The functor $\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is representable in a
number of situations. All of our results will be based on the following
basic case. The proof of this lemma as given below is in some sense the
natural generalization to the proof of \cite[III, Cor 7.7.8]{EGA}.

\begin{lemma}
\label{lemma-noetherian-hom}
In Situation \ref{situation-hom} assume that
\begin{enumerate}
\item $B$ is a Noetherian algebraic space,
\item $f$ is locally of finite type and quasi-separated,
\item $\mathcal{F}$ is a finite type $\mathcal{O}_X$-module, and
\item $\mathcal{G}$ is a finite type $\mathcal{O}_X$-module, flat over $B$,
with support proper over $B$.
\end{enumerate}
Then the functor $\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is
an algebraic space affine and of finite presentation over $B$.
\end{lemma}

\begin{proof}
We may replace $X$ by a quasi-compact open neighbourhood of
the support of $\mathcal{G}$, hence we may assume $X$ is Noetherian.
In this case $X$ and $f$ are quasi-compact and quasi-separated.
Choose an approximation $P \to \mathcal{F}$ by a perfect complex $P$ of
the triple $(X, \mathcal{F}, -1)$, see
Derived Categories of Spaces, Definition
\ref{spaces-perfect-definition-approximation-holds} and
Theorem \ref{spaces-perfect-theorem-approximation}).
Then the induced map
$$
\Hom_{\mathcal{O}_X}(\mathcal{F}, \mathcal{G})
\longrightarrow
\Hom_{D(\mathcal{O}_X)}(P, \mathcal{G})
$$
is an isomorphism because $P \to \mathcal{F}$ induces an isomorphism
$H^0(P) \to \mathcal{F}$ and $H^i(P) = 0$ for $i > 0$.
Moreover, for any morphism $g : T \to B$
denote $h : X_T = T \times_B X \to X$ the projection and set
$P_T = Lh^*P$. Then it is equally true that
$$
\Hom_{\mathcal{O}_{X_T}}(\mathcal{F}_T, \mathcal{G}_T)
\longrightarrow
\Hom_{D(\mathcal{O}_{X_T})}(P_T, \mathcal{G}_T)
$$
is an isomorphism, as $P_T = Lh^*P \to Lh^*\mathcal{F} \to \mathcal{F}_T$
induces an isomorphism $H^0(P_T) \to \mathcal{F}_T$ (because $h^*$ is
right exact and $H^i(P) = 0$ for $i > 0$). Thus it suffices to prove the
result for the functor
$$
T \longmapsto \Hom_{D(\mathcal{O}_{X_T})}(P_T, \mathcal{G}_T).
$$
By the Leray spectral sequence (see Cohomology on Sites, Remark
\ref{sites-cohomology-remark-before-Leray}) we have
$$
\Hom_{D(\mathcal{O}_{X_T})}(P_T, \mathcal{G}_T) =
H^0(X_T, R\SheafHom(P_T, \mathcal{G}_T)) =
H^0(T, Rf_{T, *}R\SheafHom(P_T, \mathcal{G}_T))
$$
where $f_T : X_T \to T$ is the base change of $f$. By
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-base-change-RHom}
we have
$$
Rf_{T, *}R\SheafHom(P_T, \mathcal{G}_T) = Lg^*Rf_*R\SheafHom(P, \mathcal{G}).
$$
By
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-ext-perfect}
the object $K = Rf_*R\SheafHom(P, \mathcal{G})$ of $D(\mathcal{O}_B)$
is perfect. This means we can apply
Lemma \ref{lemma-cohomology-perfect-complex}
as long as we can prove that the cohomology sheaf
$H^i(Lg^*K)$ is $0$ for all $i < 0$ and $g : T \to B$ as above.
This is clear from the last displayed formula as
the cohomology sheaves of
$Rf_{T, *}R\SheafHom(P_T, \mathcal{G}_T)$
are zero in negative degrees
due to the fact that $R\SheafHom(P_T, \mathcal{G}_T)$ has vanishing
cohomology sheaves in negative degrees as $P_T$ is perfect with
vanishing cohomology sheaves in positive degrees.
\end{proof}

\noindent
Here is a cheap consequence of Lemma \ref{lemma-noetherian-hom}.

\begin{proposition}
\label{proposition-hom}
In Situation \ref{situation-hom} assume that
\begin{enumerate}
\item $f$ is of finite presentation, and
\item $\mathcal{G}$ is a finitely presented $\mathcal{O}_X$-module,
flat over $B$, with support proper over $B$.
\end{enumerate}
Then the functor $\mathit{Hom}(\mathcal{F}, \mathcal{G})$ is
an algebraic space affine over $B$. If $\mathcal{F}$
is of finite presentation, then $\mathit{Hom}(\mathcal{F}, \mathcal{G})$
is of finite presentation over $B$.
\end{proposition}

\begin{proof}
By Lemma \ref{lemma-hom-sheaf} the functor
$\mathit{Hom}(\mathcal{F}, \mathcal{G})$ satisfies
the sheaf property for fppf coverings. This mean we may\footnote{We omit
the verification of the set theoretical condition (3) of the referenced
lemma.} apply
Bootstrap, Lemma \ref{bootstrap-lemma-locally-algebraic-space}
to check the representability \'etale locally on $B$. Moreover,
we may check whether the end result is affine or
of finite presentation \'etale locally on $B$, see
Morphisms of Spaces, Lemmas \ref{spaces-morphisms-lemma-affine-local} and
\ref{spaces-morphisms-lemma-finite-presentation-local}.
Hence we may assume that $B$ is an affine scheme.

\medskip\noindent
Assume $B$ is an affine scheme. As $f$ is of finite presentation, it follows
$X$ is quasi-compact and quasi-separated. Thus we can write
$\mathcal{F} = \colim \mathcal{F}_i$ as a filtered colimit of
$\mathcal{O}_X$-modules of finite presentation
(Limits of Spaces, Lemma \ref{spaces-limits-lemma-colimit-finitely-presented}).
It is clear that
$$
\mathit{Hom}(\mathcal{F}, \mathcal{G}) =
\lim \mathit{Hom}(\mathcal{F}_i, \mathcal{G})
$$
Hence if we can show that each $\mathit{Hom}(\mathcal{F}_i, \mathcal{G})$
is representable by an affine scheme, then we see that the same thing
holds for $\mathit{Hom}(\mathcal{F}, \mathcal{G})$. Use the material in
Limits, Section \ref{limits-section-limits} and
Limits of Spaces, Section \ref{spaces-limits-section-limits}.
Thus we may assume that $\mathcal{F}$ is of finite presentation.

\medskip\noindent
Say $B = \Spec(R)$. Write $R = \colim R_i$ with each $R_i$ a finite
type $\mathbf{Z}$-algebra. Set $B_i = \Spec(R_i)$. By the results of
Limits of Spaces, Lemmas
\ref{spaces-limits-lemma-descend-finite-presentation} and
\ref{spaces-limits-lemma-descend-modules-finite-presentation}
we can find an $i$, a morphism of algebraic spaces $X_i \to B_i$,
and finitely presented $\mathcal{O}_{X_i}$-modules $\mathcal{F}_i$ and
$\mathcal{G}_i$ such that the base change of
$(X_i, \mathcal{F}_i, \mathcal{G}_i)$ to $B$ recovers
$(X, \mathcal{F}, \mathcal{G})$. By
Limits of Spaces, Lemma \ref{spaces-limits-lemma-descend-flat}
we may, after increasing $i$, assume that $\mathcal{G}_i$
is flat over $B_i$. By
Limits of Spaces, Lemma \ref{spaces-limits-lemma-eventually-proper-support}
we may similarly assume the scheme theoretic support of $\mathcal{G}_i$
is proper over $B_i$. At this point we can apply
Lemma \ref{lemma-noetherian-hom}
to see that $H_i = \mathit{Hom}(\mathcal{F}_i, \mathcal{G}_i)$ is
an algebraic space affine of finite presentation over $B_i$.
Pulling back to $B$ (using Remark \ref{remark-hom-base-change})
we see that $H_i \times_{B_i} B = \mathit{Hom}(\mathcal{F}, \mathcal{G})$ 
and we win.
\end{proof}






\section{The Isom functor}
\label{section-isom}

\noindent
In Situation \ref{situation-hom} we can consider the subfunctor
$$
\mathit{Isom}(\mathcal{F}, \mathcal{G}) \subset
\mathit{Hom}(\mathcal{F}, \mathcal{G})
$$
whose value on a scheme $T$ over $B$ is the set of {\it invertible}
$\mathcal{O}_{X_T}$-homomorphisms $u : \mathcal{F}_T \to \mathcal{G}_T$.

\medskip\noindent
We sometimes think of
$\mathit{Isom}(\mathcal{F}, \mathcal{G})$ as a functor
$(\Sch/S)^{opp} \to \textit{Sets}$
endowed with a morphism
$\mathit{Isom}(\mathcal{F}, \mathcal{G}) \to B$.
Namely, if $T$ is a scheme over $S$, then an element of
$\mathit{Isom}(\mathcal{F}, \mathcal{G})(T)$ consists of a pair
$(h, u)$, where $h$ is a morphism $h : T \to B$ and
$u : \mathcal{F}_T \to \mathcal{G}_T$ is an $\mathcal{O}_{X_T}$-module
isomorphism
where $X_T = T \times_{h, B} X$ and $\mathcal{F}_T$ and $\mathcal{G}_T$
are the pullbacks to $X_T$. In particular, when we say
that $\mathit{Isom}(\mathcal{F}, \mathcal{G})$ is an algebraic space,
we mean that the corresponding functor
$(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\begin{lemma}
\label{lemma-isom-sheaf}
In Situation \ref{situation-hom} the functor
$\mathit{Isom}(\mathcal{F}, \mathcal{G})$ 
satisfies the sheaf property for the fpqc topology.
\end{lemma}

\begin{proof}
We have already seen that $\mathit{Hom}(\mathcal{F}, \mathcal{G})$
satisfies the sheaf property. Hence it remains to show the following:
Given an fpqc covering $\{T_i \to T\}_{i \in I}$ of schemes over $B$
and an $\mathcal{O}_{X_T}$-linear map
$u : \mathcal{F}_T \to \mathcal{G}_T$ such that
$u_{T_i}$ is an isomorphism for all $i$, then $u$ is an isomorphism.
Since $\{X_i \to X_T\}_{i \in I}$ is an fpqc covering of $X_T$, see
Topologies on Spaces, Lemma \ref{spaces-topologies-lemma-fpqc},
this follows from
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}.
\end{proof}

\noindent
Sanity check: $\mathit{Isom}$ sheaf plays the same role among algebraic spaces
over $S$.

\begin{lemma}
\label{lemma-extend-isom-to-spaces}
In Situation \ref{situation-hom}. Let $T$ be an algebraic space over $S$.
We have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T, \mathit{Isom}(\mathcal{F}, \mathcal{G})) =
\{(h, u) \mid
h : T \to B, u : \mathcal{F}_T \to \mathcal{G}_T\text{ isomorphism}\}
$$
where $\mathcal{F}_T, \mathcal{G}_T$ denote the pullbacks of $\mathcal{F}$
and $\mathcal{G}$ to the algebraic space $X \times_{B, h} T$.
\end{lemma}

\begin{proof}
Observe that the left and right hand side of the equality are
subsets of the left and right hand side of the equality in
Lemma \ref{lemma-extend-hom-to-spaces}.
We omit the verification that these subsets correspond under
the identification given in the proof of that lemma.
\end{proof}

\begin{proposition}
\label{proposition-isom}
In Situation \ref{situation-hom} assume that
\begin{enumerate}
\item $f$ is of finite presentation, and
\item $\mathcal{F}$ and $\mathcal{G}$ are finitely presented
$\mathcal{O}_X$-modules, flat over $B$, with support proper over $B$.
\end{enumerate}
Then the functor $\mathit{Isom}(\mathcal{F}, \mathcal{G})$ is
an algebraic space affine of finite presentation over $B$.
\end{proposition}

\begin{proof}
We will use the abbreviations
$H = \mathit{Hom}(\mathcal{F}, \mathcal{G})$,
$I = \mathit{Hom}(\mathcal{F}, \mathcal{F})$,
$H' = \mathit{Hom}(\mathcal{G}, \mathcal{F})$, and
$I' = \mathit{Hom}(\mathcal{G}, \mathcal{G})$.
By Proposition \ref{proposition-hom} the functors
$H$, $I$, $H'$, $I'$ are algebraic spaces and the morphisms
$H \to B$, $I \to B$, $H' \to B$, and $I' \to B$
are affine and of finite presentation.
The composition of maps gives a morphism
$$
c : H' \times_B H \longrightarrow I \times_B I',\quad
(u', u) \longmapsto (u \circ u', u' \circ u)
$$
of algebraic spaces over $B$. Since $I \times_B I' \to B$ is separated,
the section $\sigma : B \to I \times_B I'$ corresponding to
$(\text{id}_\mathcal{F}, \text{id}_\mathcal{G})$
is a closed immersion
(Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-section-immersion}).
Moreover, $\sigma$ is of finite presentation
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-finite-presentation-permanence}).
Hence
$$
\mathit{Isom}(\mathcal{F}, \mathcal{G}) =
(H' \times_B H) \times_{c, I \times_B I', \sigma} B
$$
is an algebraic space affine of finite presentation over $B$ as well.
Some details omitted.
\end{proof}






\section{The stack of coherent sheaves}
\label{section-stack-coherent-sheaves}

\noindent
In this section we prove that the stack of coherent sheaves 
on $X/B$ is algebraic under suitable hypotheses. This is a
special case of \cite[Theorem 2.1.1]{lieblich_remarks}
which treats the case of the stack of coherent sheaves on an
Artin stack over a base.

\begin{situation}
\label{situation-coherent}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$. Assume that $f$ is of finite presentation.
We denote $\Cohstack_{X/B}$ the category whose objects are
triples $(T, g, \mathcal{F})$ where
\begin{enumerate}
\item $T$ is a scheme over $S$,
\item $g : T \to B$ is a morphism over $S$, and setting
$X_T = T \times_{g, B} X$
\item $\mathcal{F}$ is a quasi-coherent $\mathcal{O}_{X_T}$-module
of finite presentation, flat over $T$, with support proper over $T$.
\end{enumerate}
A morphism $(T, g, \mathcal{F}) \to (T', g', \mathcal{F}')$
is given by a pair $(h, \varphi)$ where
\begin{enumerate}
\item $h : T \to T'$ is a morphism of schemes over $B$
(i.e., $g' \circ h = g$), and
\item $\varphi : (h')^*\mathcal{F}' \to \mathcal{F}$ is an
isomorphism of $\mathcal{O}_{X_T}$-modules where $h' : X_T \to X_{T'}$
is the base change of $h$.
\end{enumerate}
\end{situation}

\noindent
Thus $\Cohstack_{X/B}$ is a category and the rule
$$
p : \Cohstack_{X/B} \longrightarrow (\Sch/S)_{fppf},
\quad
(T, g, \mathcal{F}) \longmapsto T
$$
is a functor. For a scheme $T$ over $S$ we denote $\Cohstack_{X/B, T}$
the fibre category of $p$ over $T$. These fibre categories are groupoids.

\begin{lemma}
\label{lemma-coherent-fibred-in-groupoids}
In Situation \ref{situation-coherent} the functor
$p : \Cohstack_{X/B} \longrightarrow (\Sch/S)_{fppf}$
is fibred in groupoids.
\end{lemma}

\begin{proof}
We show that $p$ is fibred in groupoids by checking conditions
(1) and (2) of Categories, Definition
\ref{categories-definition-fibred-groupoids}.
Given an object $(T', g', \mathcal{F}')$
of $\Cohstack_{X/B}$ and a morphism $h : T \to T'$ of
schemes over $S$ we can set $g = h \circ g'$ and
$\mathcal{F} = (h')^*\mathcal{F}'$ where $h' : X_T \to X_{T'}$
is the base change of $h$. Then it is clear that we obtain
a morphism $(T, g, \mathcal{F}) \to (T', g', \mathcal{F}')$
of $\Cohstack_{X/B}$ lying over $h$. This proves (1).
For (2) suppose we are given morphisms
$$
(h_1, \varphi_1) : (T_1, g_1, \mathcal{F}_1) \to (T, g, \mathcal{F})
\quad\text{and}\quad
(h_2, \varphi_2) : (T_2, g_2, \mathcal{F}_2) \to (T, g, \mathcal{F})
$$
of $\Cohstack_{X/B}$ and a morphism $h : T_1 \to T_2$ such that
$h_2 \circ h = h_1$. Then we can let $\varphi$ be the composition
$$
(h')^*\mathcal{F}_2
\xrightarrow{(h')^*\varphi_2^{-1}}
(h')^*(h_2)^*\mathcal{F} = (h_1)^*\mathcal{F}
\xrightarrow{\varphi_1}
\mathcal{F}_1
$$
to obtain the morphism
$(h, \varphi) : (T_1, g_1, \mathcal{F}_1) \to (T_2, g_2, \mathcal{F}_2)$
that witnesses the truth of condition (2).
\end{proof}

\begin{lemma}
\label{lemma-coherent-diagonal}
In Situation \ref{situation-coherent}. Denote
$\mathcal{X} = \Cohstack_{X/B}$. Then
$\Delta : \mathcal{X} \to \mathcal{X} \times \mathcal{X}$ is
representable by algebraic spaces.
\end{lemma}

\begin{proof}
Consider two objects $x = (T, g, \mathcal{F})$ and $y = (T, h, \mathcal{G})$
of $\mathcal{X}$ over a scheme $T$. We have to show that
$\mathit{Isom}_\mathcal{X}(x, y)$ is an algebraic space over $T$, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-representable-diagonal}.
If for $a : T' \to T$ the restrictions $x|_{T'}$ and $y|_{T'}$ are isomorphic
in the fibre category $\mathcal{X}_{T'}$, then $g \circ a = h \circ a$.
Hence there is a transformation of presheaves
$$
\mathit{Isom}_\mathcal{X}(x, y) \longrightarrow \text{Equalizer}(g, h)
$$
Since the diagonal of $B$ is representable (by schemes) this equalizer is
a scheme. Thus we may replace $T$ by this equalizer and the sheaves
$\mathcal{F}$ and $\mathcal{G}$ by their pullbacks. Thus we may assume
$g = h$. In this case we have
$\mathit{Isom}_\mathcal{X}(x, y) = \mathit{Isom}(\mathcal{F}, \mathcal{G})$
and the result follows from Proposition \ref{proposition-isom}.
\end{proof}

\begin{lemma}
\label{lemma-coherent-stack}
In Situation \ref{situation-coherent} the functor
$p : \Cohstack_{X/B} \longrightarrow (\Sch/S)_{fppf}$
is a stack in groupoids.
\end{lemma}

\begin{proof}
To prove that $\Cohstack_{X/B}$ is a stack in groupoids, we have to show
that the presheaves $\mathit{Isom}$ are sheaves and that descent data are
effective. The statement on $\mathit{Isom}$ follows from
Lemma \ref{lemma-coherent-diagonal}, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-representable-diagonal}.
Let us prove the statement on descent data.
Suppose that $\{a_i : T_i \to T\}$ is an fppf covering of schemes over $S$.
Let $(\xi_i, \varphi_{ij})$ be a descent datum for $\{T_i \to T\}$
with values in $\Cohstack_{X/B}$.
For each $i$ we can write $\xi_i = (T_i, g_i, \mathcal{F}_i)$.
Denote $\text{pr}_0 : T_i \times_T T_j \to T_i$ and
$\text{pr}_1 : T_i \times_T T_j \to T_j$ the projections.
The condition that $\xi_i|_{T_i \times_T T_j} = \xi_j|_{T_i \times_T T_j}$
implies in particular that $g_i \circ \text{pr}_0 = g_j \circ \text{pr}_1$.
Thus there exists a unique morphism $g : T \to B$ such that
$g_i = g \circ a_i$, see
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-fpqc-universal-effective-epimorphisms}.
Denote $X_T = T \times_{g, B} X$. Set
$X_i = X_{T_i} = T_i \times_{g_i, B} X = T_i \times_{a_i, T} X_T$
and
$$
X_{ij} = X_{T_i} \times_{X_T} X_{T_j} = X_i \times_{X_T} X_j
$$
with projections $\text{pr}_i$ and $\text{pr}_j$ to $X_i$ and $X_j$.
Observe that the pullback of $(T_i, g_i, \mathcal{F}_i)$
by $\text{pr}_0 : T_i \times_T T_j \to T_i$ is given by
$(T_i \times_T T_j, g_i \circ \text{pr}_0, \text{pr}_i^*\mathcal{F}_i)$.
Hence a descent datum for $\{T_i \to T\}$ in $\Cohstack_{X/B}$
is given by the objects $(T_i, g \circ a_i, \mathcal{F}_i)$
and for each pair $i, j$ an isomorphism of $\mathcal{O}_{X_{ij}}$-modules
$$
\varphi_{ij} :
\text{pr}_i^*\mathcal{F}_i \longrightarrow \text{pr}_j^*\mathcal{F}_j
$$
satisfying the cocycle condition over (the pullback of $X$ to)
$T_i \times_T T_j \times_T T_k$.
Ok, and now we simply use that $\{X_i \to X_T\}$ is an fppf covering
so that we can view $(\mathcal{F}_i, \varphi_{ij})$ as a descent datum
for this covering. By
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
this descent datum is effective and we obtain a quasi-coherent
sheaf $\mathcal{F}$ over $X_T$ restricting to $\mathcal{F}_i$ on $X_i$.
By Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-permanence}
we see that $\mathcal{F}$ is flat over $T$ and
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-finite-presentation-descends}
guarantees that $\mathcal{Q}$ is of finite presentation as an
$\mathcal{O}_{X_T}$-module. Finally, by
Descent on Spaces, Lemma \ref{spaces-descent-lemma-descending-property-proper}
we see that the scheme theoretic support of $\mathcal{F}$ is proper over
$T$ as we've assumed the scheme theoretic support of $\mathcal{F}_i$
is proper over $T_i$ (note that taking scheme theoretic support commutes
with flat base change by
Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-pullback-support}).
In this way we obtain our desired object over $T$.
\end{proof}

\begin{remark}
\label{remark-coherent-base-change}
In Situation \ref{situation-coherent} the rule
$(T, g, \mathcal{F}) \mapsto (T, g)$ defines a $1$-morphism
$$
\Cohstack_{X/B} \longrightarrow \mathcal{S}_B
$$
of stacks in groupoids
(see Lemma \ref{lemma-coherent-stack},
Algebraic Stacks, Section \ref{algebraic-section-split}, and
Examples of Stacks, Section
\ref{examples-stacks-section-stack-associated-to-sheaf}).
Let $B' \to B$ be a morphism of
algebraic spaces over $S$. Let $\mathcal{S}_{B'} \to \mathcal{S}_B$
be the associated $1$-morphism of stacks fibred in sets.
Set $X' = X \times_B B'$.
We obtain a stack in groupoids $\Cohstack_{X'/B'} \to (\Sch/S)_{fppf}$
associated to the base change $f' : X' \to B'$. In this situation
the diagram
$$
\vcenter{
\xymatrix{
\Cohstack_{X'/B'} \ar[r] \ar[d] & \Cohstack_{X/B} \ar[d] \\
\mathcal{S}_{B'} \ar[r] & \mathcal{S}_B
}
}
\quad
\begin{matrix}
\text{or in} \\
\text{another} \\
\text{notation}
\end{matrix}
\quad
\vcenter{
\xymatrix{
\Cohstack_{X'/B'} \ar[r] \ar[d] & \Cohstack_{X/B} \ar[d] \\
\Sch/B' \ar[r] & \Sch/B
}
}
$$
is $2$-fibre product square. This trivial remark
will occasionally be useful to change the base algebraic space.
\end{remark}

\begin{lemma}
\label{lemma-coherent-limits}
In Situation \ref{situation-coherent} assume that $B \to S$
is locally of finite presentation. Then
$p : \Cohstack_{X/B} \to (\Sch/S)_{fppf}$ is limit preserving
(Artin's Axioms, Definition \ref{artin-definition-limit-preserving}).
\end{lemma}

\begin{proof}
Write $B(T)$ for the discrete category whose
objects are the $S$-morphisms $T \to B$. Let $T = \lim T_i$ be a filtered
limit of affine schemes over $S$. Assigning to an object
$(T, h, \mathcal{F})$ of $\Cohstack_{X/B, T}$ the object $h$
of $B(T)$ gives us a commutative diagram of fibre categories
$$
\xymatrix{
\colim \Cohstack_{X/B, T_i} \ar[r] \ar[d] &
\Cohstack_{X/B, T} \ar[d] \\
\colim B(T_i) \ar[r] & B(T)
}
$$
We have to show the top horizontal arrow is an equivalence. Since
we have assumed that $B$ is locally of finite presentation over $S$
we see from
Limits of Spaces, Remark \ref{spaces-limits-remark-limit-preserving}
that the bottom horizontal arrow is an equivalence. This means that
we may assume $T = \lim T_i$ be a filtered limit of affine schemes over
$B$. Denote $g_i : T_i \to B$ and $g : T \to B$ the corresponding
morphisms. Set $X_i = T_i \times_{g_i, B} X$ and $X_T = T \times_{g, B} X$.
Observe that $X_T = \colim X_i$ and that the algebraic spaces
$X_i$ and $X_T$ are quasi-separated and quasi-compact (as they
are of finite presentation over the affines $T_i$ and $T$).
By Limits of Spaces, Lemma
\ref{spaces-limits-lemma-descend-modules-finite-presentation}
we see that
$$
\colim \textit{FP}(X_i) = \textit{FP}(X_T).
$$
where $\textit{FP}(W)$ is short hand for the category of finitely
presented $\mathcal{O}_W$-modules. The results of
Limits of Spaces, Lemmas \ref{spaces-limits-lemma-descend-flat} and
\ref{spaces-limits-lemma-eventually-proper-support}
tell us the same thing is true if we replace $\textit{FP}(X_i)$
and $\textit{FP}(X_T)$ by the full subcategory of objects
flat over $T_i$ and $T$ with scheme theoretic support proper
over $T_i$ and $T$. This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-coherent-RS-star}
In Situation \ref{situation-coherent}. Let
$$
\xymatrix{
Z \ar[r] \ar[d] & Z' \ar[d] \\
Y \ar[r] & Y'
}
$$
be a pushout in the category of schemes over $S$ where
$Z \to Z'$ is a thickening and $Z \to Y$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the functor on fibre categories
$$
\Cohstack_{X/B, Y'}
\longrightarrow
\Cohstack_{X/B, Y} \times_{\Cohstack_{X/B, Z}} \Cohstack_{X/B, Z'}
$$
is an equivalence.
\end{lemma}

\begin{proof}
Observe that the corresponding map
$$
B(Y') \longrightarrow B(Y) \times_{B(Z)} B(Z')
$$
is a bijection, see Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-pushout-along-thickening-schemes}.
Thus using the commutative diagram
$$
\xymatrix{
\Cohstack_{X/B, Y'} \ar[r] \ar[d] &
\Cohstack_{X/B, Y} \times_{\Cohstack_{X/B, Z}} \Cohstack_{X/B, Z'}
\ar[d] \\
B(Y') \ar[r] & B(Y) \times_{B(Z)} B(Z')
}
$$
we see that we may assume that $Y'$ is a scheme over $B'$. By
Remark \ref{remark-coherent-base-change}
we may replace $B$ by $Y'$ and $X$ by $X \times_B Y'$.
Thus we may assume $B = Y'$. In this case the statement follows from
Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-space-over-pushout-flat-modules}.
\end{proof}

\begin{lemma}
\label{lemma-coherent-over-first-order-thickening}
Let
$$
\xymatrix{
X \ar[d] \ar[r]_i & X' \ar[d] \\
T \ar[r] & T'
}
$$
be a cartesian square of algebraic spaces where $T \to T'$ is a first
order thickening. Let $\mathcal{F}'$ be an $\mathcal{O}_{X'}$-module
flat over $T'$. Set $\mathcal{F} = i^*\mathcal{F}'$. The following
are equivalent
\begin{enumerate}
\item $\mathcal{F}'$ is a quasi-coherent $\mathcal{O}_{X'}$-module
of finite presentation,
\item $\mathcal{F}'$ is an $\mathcal{O}_{X'}$-module of finite presentation,
\item $\mathcal{F}$ is a quasi-coherent $\mathcal{O}_X$-module
of finite presentation,
\item $\mathcal{F}$ is an $\mathcal{O}_X$-module of finite presentation,
\end{enumerate}
\end{lemma}

\begin{proof}
Recall that a finitely presented module is quasi-coherent hence the
equivalence of (1) and (2) and (3) and (4). The equivalence of (2)
and (4) is a special case of Deformation Theory, Lemma
\ref{defos-lemma-deform-fp-module-ringed-topoi}.
\end{proof}

\begin{lemma}
\label{lemma-coherent-tangent-space}
In Situation \ref{situation-coherent} assume that $S$ is a locally Noetherian
scheme and $B \to S$ is locally of finite presentation.
Let $k$ be a finite type field over $S$ and let
$x_0 = (\Spec(k), g_0, \mathcal{G}_0)$
be an object of $\mathcal{X} = \Cohstack_{X/B}$ over $k$. Then
the spaces $T\mathcal{F}_{\mathcal{X}, k, x_0}$ and
$\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x_0})$
(Artin's Axioms, Section \ref{artin-section-tangent-spaces})
are finite dimensional.
\end{lemma}

\begin{proof}
Observe that by Lemma \ref{lemma-coherent-RS-star}
our stack in groupoids $\mathcal{X}$ satisfies property (RS*)
defined in Artin's Axioms, Section \ref{artin-section-inf}.
In particular $\mathcal{X}$ satisfies (RS).
Hence all associated predeformation
categories are deformation categories
(Artin's Axioms, Lemma \ref{artin-lemma-deformation-category})
and the statement makes sense.

\medskip\noindent
In this paragraph we show that we can reduce to the case $B = \Spec(k)$.
Set $X_0 = \Spec(k) \times_{g_0, B} X$
and denote $\mathcal{X}_0 = \Cohstack_{X_0/k}$. In
Remark \ref{remark-coherent-base-change} we have seen that
$\mathcal{X}_0$ is the $2$-fibre product of $\mathcal{X}$ with
$\Spec(k)$ over $B$ as categories fibred in groupoids over
$(\Sch/S)_{fppf}$. Thus by
Artin's Axioms, Lemma \ref{artin-lemma-fibre-product-tangent-spaces}
we reduce to proving that $B$, $\Spec(k)$, and $\mathcal{X}_0$
have finite dimensional tangent spaces and infinitesimal automorphism
spaces. The tangent space of $B$ and $\Spec(k)$ are finite dimensional by
Artin's Axioms, Lemma \ref{artin-lemma-finite-dimension}
and of course these have vanishing $\text{Inf}$.
Thus it suffices to deal with $\mathcal{X}_0$.

\medskip\noindent
Let $k[\epsilon]$ be the dual numbers over $k$.
Let $\Spec(k[\epsilon]) \to B$ be the composition of $g_0 : \Spec(k) \to B$
and the morphism $\Spec(k[\epsilon]) \to \Spec(k)$
coming from the inclusion $k \to k[\epsilon]$.
Set $X_0 = \Spec(k) \times_B X$ and
$X_\epsilon = \Spec(k[\epsilon]) \times_B X$.
Observe that $X_\epsilon$ is a first order thickening of $X_0$
flat over the first order thickening $\Spec(k) \to \Spec(k[\epsilon])$.
Unwinding the definitions and using
Lemma \ref{lemma-coherent-over-first-order-thickening}
we see that $T\mathcal{F}_{\mathcal{X}_0, k, x_0}$ is the set of
lifts of $\mathcal{G}_0$ to a flat module on $X_\epsilon$.
By Deformation Theory, Lemma \ref{defos-lemma-flat-ringed-topoi}
we conclude that
$$
T\mathcal{F}_{\mathcal{X}_0, k, x_0} =
\Ext^1_{\mathcal{O}_{X_0}}(\mathcal{G}_0, \mathcal{G}_0)
$$
Here we have used the identification $\epsilon k[\epsilon] \cong k$
of $k[\epsilon]$-modules. Using
Deformation Theory, Lemma \ref{defos-lemma-flat-ringed-topoi}
once more we see that
$$
\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x_0}) =
\Ext^0_{\mathcal{O}_{X_0}}(\mathcal{G}_0, \mathcal{G}_0)
$$
These spaces are finite dimensional over $k$ as $\mathcal{G}_0$
has support proper over $\Spec(k)$. Namely, $X_0$ is of finite presentation
over $\Spec(k)$, hence Noetherian. Since $\mathcal{G}_0$ is of finite
presentation it is a coherent $\mathcal{O}_{X_0}$-module. Thus we may apply
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-ext-finite}
to conclude the desired finiteness.
\end{proof}

\begin{lemma}
\label{lemma-coherent-existence}
In Situation \ref{situation-coherent} assume that $S$ is a locally Noetherian
scheme and that $f : X \to B$ is separated.
Let $\mathcal{X} = \Cohstack_{X/B}$. Then the functor
Artin's Axioms, Equation (\ref{artin-equation-approximation})
is an equivalence.
\end{lemma}

\begin{proof}
Let $A$ be an $S$-algebra which is a complete local Noetherian ring
with maximal ideal $\mathfrak m$
whose residue field $k$ is of finite type over $S$.
We have to show that the category of objects over $A$ is
equivalent to the category of formal objects over $A$.
Since we know this holds for the category $\mathcal{S}_B$
fibred in sets associated to $B$ by Artin's Axioms, 
Lemma \ref{artin-lemma-effective}, it suffices to prove this
for those objects lying over a given morphism $\Spec(A) \to B$.

\medskip\noindent
Set $X_A = \Spec(A) \times_B X$ and $X_n = \Spec(A/\mathfrak m^n) \times_B X$.
By Grothendieck's existence theorem
(More on Morphisms of Spaces, Theorem
\ref{spaces-more-morphisms-theorem-grothendieck-existence})
we see that the category of coherent modules $\mathcal{F}$
on $X_A$ with support proper over $\Spec(A)$ is equivalent
to the category of systems $(\mathcal{F}_n)$ of coherent modules
$\mathcal{F}_n$ on $X_n$ with support proper over
$\Spec(A/\mathfrak m^n)$. The equivalence sends $\mathcal{F}$
to the system $(\mathcal{F} \otimes_A A/\mathfrak m^n)$. See discussion in
More on Morphisms of Spaces, Remark
\ref{spaces-more-morphisms-remark-reformulate-existence-theorem}.
To finish the proof of the lemma, it suffices to show that
$\mathcal{F}$ is flat over $A$ if and only if all
$\mathcal{F} \otimes_A A/\mathfrak m^n$ are flat over $A/\mathfrak m^n$.
This follows from
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-flatness-over-Noetherian-ring}.
\end{proof}

\begin{lemma}
\label{lemma-coherent-defo-thy}
In Situation \ref{situation-coherent} assume that
$S$ is a locally Noetherian scheme, $S = B$, and $f : X \to B$ is flat.
Let $\mathcal{X} = \Cohstack_{X/B}$. Then we have openness of
versality for $\mathcal{X}$ (see
Artin's Axioms, Definition \ref{artin-definition-openness-versality}).
\end{lemma}

\begin{proof}[First proof]
This proof is based on the criterion of
Artin's Axioms, Lemma \ref{artin-lemma-dual-openness}.
Let $U \to S$ be of finite type morphism of schemes, $x$ an object of
$\mathcal{X}$ over $U$ and $u_0 \in U$ a finite type point such that
$x$ is versal at $u_0$. After shrinking $U$ we may assume that $u_0$
is a closed point (Morphisms, Lemma \ref{morphisms-lemma-point-finite-type})
and $U = \Spec(A)$ with $U \to S$ mapping into an
affine open $\Spec(\Lambda)$ of $S$.
Let $\mathcal{F}$ be the coherent module on $X_A = \Spec(A) \times_S X$
flat over $A$ corresponding to the given object $x$.

\medskip\noindent
According to Deformation Theory, Lemma \ref{defos-lemma-flat-ringed-topoi}
we have an isomorphism of functors
$$
T_x(M) = \Ext^1_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)
$$
and given any surjection $A' \to A$ of $\Lambda$-algebras with square zero
kernel $I$ we have an obstruction class
$$
\xi_{A'} \in \Ext^2_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A I)
$$
This uses that for any $A' \to A$ as above the base change
$X_{A'} = \Spec(A') \times_B X$ is flat over $A'$.
Moreover, the construction of the obstruction class is functorial
in the surjection $A' \to A$ (for fixed $A$) by
Deformation Theory, Lemma \ref{defos-lemma-functorial-ringed-topoi}.
Apply Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-compute-ext}
to the computation of the Ext groups
$\Ext^i_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)$
for $i \leq m$ with $m = 2$. We find a perfect object $K \in D(A)$
and functorial isomorphisms
$$
H^i(K \otimes_A^\mathbf{L} M)
\longrightarrow
\Ext^i_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)
$$
for $i \leq m$ compatible with boundary maps. This object $K$, together
with the displayed identifications above gives us a datum as in
Artin's Axioms, Situation \ref{artin-situation-dual}.
Finally, condition (iv) of
Artin's Axioms, Lemma \ref{artin-lemma-dual-obstruction}
holds by 
Deformation Theory, Lemma \ref{defos-lemma-verify-iv-ringed-topoi}.
Thus Artin's Axioms, Lemma \ref{artin-lemma-dual-openness}
does indeed apply and the lemma is proved.
\end{proof}

\begin{proof}[Second proof]
This proof is based on
Artin's Axioms, Lemma \ref{artin-lemma-get-openness-obstruction-theory}.
Conditions (1), (2), and (3) of that lemma correspond to
Lemmas \ref{lemma-coherent-diagonal},
\ref{lemma-coherent-RS-star}, and
\ref{lemma-coherent-limits}.

\medskip\noindent
We have constructed an obstruction theory in the chapter on
deformation theory. Namely, given an $S$-algebra $A$ and an
object $x$ of $\Cohstack_{X/B}$ over $\Spec(A)$ given
by $\mathcal{F}$ on $X_A$ we set
$\mathcal{O}_x(M) = \Ext^2_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)$
and if $A' \to A$ is a surjection with kernel $I$, then as obstruction
element we take the element
$$
o_x(A') = o(\mathcal{F}, \mathcal{F} \otimes_A I, 1) \in
\mathcal{O}_x(I) = \Ext^2_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A I)
$$
of Deformation Theory, Lemma \ref{defos-lemma-flat-ringed-topoi}.
All properties of an obstruction theory as defined in
Artin's Axioms, Definition \ref{artin-definition-obstruction-theory}
follow from this lemma except for functoriality of obstruction classes
as formulated in condition (ii) of the definition. But as stated in
the footnote to assumption (4) of
Artin's Axioms, Lemma \ref{artin-lemma-get-openness-obstruction-theory}
it suffices to check functoriality of obstruction classes
for a fixed $A$ which follows from
Deformation Theory, Lemma \ref{defos-lemma-functorial-ringed-topoi}.
Deformation Theory, Lemma \ref{defos-lemma-flat-ringed-topoi}
also tells us that
$T_x(M) = \Ext^1_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)$
for any $A$-module $M$.

\medskip\noindent
To finish the proof it suffices to show that
$T_x(\prod M_n) = \prod T_x(M_n)$ and
$\mathcal{O}_x(\prod M_n) = \prod \mathcal{O}_x(M)$.
Apply Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-compute-ext}
to the computation of the Ext groups
$\Ext^i_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)$
for $i \leq m$ with $m = 2$. We find a perfect object $K \in D(A)$
and functorial isomorphisms
$$
H^i(K \otimes_A^\mathbf{L} M)
\longrightarrow
\Ext^i_{X_A}(\mathcal{F}, \mathcal{F} \otimes_A M)
$$
for $i = 1, 2$. A straightforward argument shows that
$$
H^i(K \otimes_A^\mathbf{L} \prod M_n) =
\prod H^i(K \otimes_A^\mathbf{L} M_n)
$$
whenever $K$ is a pseudo-coherent object of $D(A)$.
In fact, this property (for all $i$) characterizes
pseudo-coherent complexes, see
More on Algebra, Lemma \ref{more-algebra-lemma-pseudo-coherent-tensor}.
\end{proof}

\begin{theorem}[Algebraicity of the stack of coherent sheaves; flat case]
\label{theorem-coherent-algebraic}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$. Assume that $f$ is of finite presentation, separated, and
flat\footnote{This assumption is not necessary. See
Section \ref{section-not-flat}.}. Then $\Cohstack_{X/B}$ is
an algebraic stack over $S$.
\end{theorem}

\begin{proof}
Set $\mathcal{X} = \Cohstack_{X/B}$. We have seen that $\mathcal{X}$
is a stack in groupoids over $(\Sch/S)_{fppf}$ with diagonal representable
by algebraic spaces
(Lemmas \ref{lemma-coherent-stack} and \ref{lemma-coherent-diagonal}).
Hence it suffices to find a scheme $W$ and a surjective and smooth
morphism $W \to \mathcal{X}$.

\medskip\noindent
Let $B'$ be a scheme and let $B' \to B$ be a surjective \'etale morphism.
Set $X' = B' \times_B X$ and denote $f' : X' \to B'$ the projection.
Then $\mathcal{X}' = \Cohstack_{X'/B'}$ is equal to the $2$-fibre
product of $\mathcal{X}$ with the category fibred in sets
associated to $B'$ over the category fibred in sets associated to $B$
(Remark \ref{remark-coherent-base-change}). By the material in
Algebraic Stacks, Section \ref{algebraic-section-representable-properties}
the morphism $\mathcal{X}' \to \mathcal{X}$ is surjective and \'etale.
Hence it suffices to prove the result for $\mathcal{X}'$.
In other words, we may assume $B$ is a scheme.

\medskip\noindent
Assume $B$ is a scheme. In this case we may replace $S$ by $B$, see
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme}.
Thus we may assume $S = B$.

\medskip\noindent
Assume $S = B$. Choose an affine open covering $S = \bigcup U_i$.
Denote $\mathcal{X}_i$ the restriction of $\mathcal{X}$ to
$(\Sch/U_i)_{fppf}$. If we can find schemes $W_i$ over $U_i$ and
surjective smooth morphisms $W_i \to \mathcal{X}_i$, then we
set $W = \coprod W_i$ and we obtain a surjective smooth morphism
$W \to \mathcal{X}$. Thus we may assume $S = B$ is affine.

\medskip\noindent
Assume $S = B$ is affine, say $S = \Spec(\Lambda)$.
Write $\Lambda = \colim \Lambda_i$ as a filtered colimit with each $\Lambda_i$
of finite type over $\mathbf{Z}$. For some $i$ we can find
a morphism of algebraic spaces $X_i \to \Spec(\Lambda_i)$
which is of finite presentation, separated, and flat and whose base change
to $\Lambda$ is $X$. See
Limits of Spaces, Lemmas
\ref{spaces-limits-lemma-descend-finite-presentation},
\ref{spaces-limits-lemma-descend-separated-morphism}, and
\ref{spaces-limits-lemma-descend-flat}.
If we show that $\Cohstack_{X_i/\Spec(\Lambda_i)}$ is an
algebraic stack, then it follows by base change
(Remark \ref{remark-coherent-base-change} and
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme})
that $\mathcal{X}$ is an algebraic stack.
Thus we may assume that $\Lambda$ is a finite type $\mathbf{Z}$-algebra.

\medskip\noindent
Assume $S = B = \Spec(\Lambda)$ is affine of finite type over $\mathbf{Z}$.
In this case we will verify conditions (1), (2), (3), (4), and (5) of
Artin's Axioms, Lemma \ref{artin-lemma-diagonal-representable}
to conclude that $\mathcal{X}$ is an algebraic stack.
Note that $\Lambda$ is a G-ring, see
More on Algebra, Proposition \ref{more-algebra-proposition-ubiquity-G-ring}.
Hence all local rings of $S$ are G-rings. Thus (5) holds.
By Lemma \ref{lemma-coherent-defo-thy}
we have that $\mathcal{X}$ satisfies openness of versality, hence (4) holds.
To check (2) we have to verify axioms [-1], [0], [1], [2], and [3]
of Artin's Axioms, Section \ref{artin-section-axioms}.
We omit the verification of [-1] and axioms
[0], [1], [2], [3] correspond respectively to
Lemmas \ref{lemma-coherent-stack},
\ref{lemma-coherent-limits},
\ref{lemma-coherent-RS-star},
\ref{lemma-coherent-tangent-space}.
Condition (3) follows from Lemma \ref{lemma-coherent-existence}.
Finally, condition (1) is Lemma \ref{lemma-coherent-diagonal}.
This finishes the proof of the theorem.
\end{proof}








\section{The stack of coherent sheaves in the non-flat case}
\label{section-not-flat}

\noindent
In Theorem \ref{theorem-coherent-algebraic} the assumption that $f : X \to B$
is flat is not necessary. In this section we give a different proof
which avoids the flatness assumption and avoids checking openness
of versality by using the results
in Flatness on Spaces, Section \ref{spaces-flat-section-existence} and
Artin's Axioms, Section \ref{artin-section-strong-formal-effectiveness}.

\medskip\noindent
For a different approach to this problem the reader may wish to consult
\cite{ArtinI} and follow the method discussed in the papers
\cite{olsson-starr}, \cite{lieblich_remarks}, \cite{olsson_proper},
\cite{Hall-Rydh}, \cite{Hall-Rydh-Hilbert}, \cite{rydh_representability}.
Some of these papers deal with the more general case of the stack of
coherent sheaves on an algebraic stack over an algebraic stack and
others deal with similar problems in the case of Hilbert stacks
or Quot functors. Our strategy will be to show algebraicity of some
cases of Hilbert stacks and Quot functors as a consequence of the
algebraicity of the stack of coherent sheaves.

\begin{theorem}[Algebraicity of the stack of coherent sheaves; general case]
\label{theorem-coherent-algebraic-general}
Let $S$ be a scheme. Let $f : X \to B$ be morphism of algebraic spaces
over $S$. Assume that $f$ is of finite presentation and separated. Then
$\Cohstack_{X/B}$ is an algebraic stack over $S$.
\end{theorem}

\begin{proof}
Only the last step of the proof is different from the proof
in the flat case, but we repeat all the arguments here to make 
sure everything works.

\medskip\noindent
Set $\mathcal{X} = \Cohstack_{X/B}$. We have seen that $\mathcal{X}$
is a stack in groupoids over $(\Sch/S)_{fppf}$ with diagonal representable
by algebraic spaces
(Lemmas \ref{lemma-coherent-stack} and \ref{lemma-coherent-diagonal}).
Hence it suffices to find a scheme $W$ and a surjective and smooth
morphism $W \to \mathcal{X}$.

\medskip\noindent
Let $B'$ be a scheme and let $B' \to B$ be a surjective \'etale morphism.
Set $X' = B' \times_B X$ and denote $f' : X' \to B'$ the projection.
Then $\mathcal{X}' = \Cohstack_{X'/B'}$ is equal to the $2$-fibre
product of $\mathcal{X}$ with the category fibred in sets
associated to $B'$ over the category fibred in sets associated to $B$
(Remark \ref{remark-coherent-base-change}). By the material in
Algebraic Stacks, Section \ref{algebraic-section-representable-properties}
the morphism $\mathcal{X}' \to \mathcal{X}$ is surjective and \'etale.
Hence it suffices to prove the result for $\mathcal{X}'$.
In other words, we may assume $B$ is a scheme.

\medskip\noindent
Assume $B$ is a scheme. In this case we may replace $S$ by $B$, see
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme}.
Thus we may assume $S = B$.

\medskip\noindent
Assume $S = B$. Choose an affine open covering $S = \bigcup U_i$.
Denote $\mathcal{X}_i$ the restriction of $\mathcal{X}$ to
$(\Sch/U_i)_{fppf}$. If we can find schemes $W_i$ over $U_i$ and
surjective smooth morphisms $W_i \to \mathcal{X}_i$, then we
set $W = \coprod W_i$ and we obtain a surjective smooth morphism
$W \to \mathcal{X}$. Thus we may assume $S = B$ is affine.

\medskip\noindent
Assume $S = B$ is affine, say $S = \Spec(\Lambda)$.
Write $\Lambda = \colim \Lambda_i$ as a filtered colimit with each $\Lambda_i$
of finite type over $\mathbf{Z}$. For some $i$ we can find
a morphism of algebraic spaces $X_i \to \Spec(\Lambda_i)$
which is separated and of finite presentation and whose base change
to $\Lambda$ is $X$. See Limits of Spaces, Lemmas
\ref{spaces-limits-lemma-descend-finite-presentation} and
\ref{spaces-limits-lemma-descend-separated-morphism}.
If we show that $\Cohstack_{X_i/\Spec(\Lambda_i)}$ is an
algebraic stack, then it follows by base change
(Remark \ref{remark-coherent-base-change} and
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme})
that $\mathcal{X}$ is an algebraic stack.
Thus we may assume that $\Lambda$ is a finite type $\mathbf{Z}$-algebra.

\medskip\noindent
Assume $S = B = \Spec(\Lambda)$ is affine of finite type over $\mathbf{Z}$.
In this case we will verify conditions (1), (2), (3), (4), and (5) of
Artin's Axioms, Lemma \ref{artin-lemma-diagonal-representable}
to conclude that $\mathcal{X}$ is an algebraic stack.
Note that $\Lambda$ is a G-ring, see
More on Algebra, Proposition \ref{more-algebra-proposition-ubiquity-G-ring}.
Hence all local rings of $S$ are G-rings. Thus (5) holds.
To check (2) we have to verify axioms [-1], [0], [1], [2], and [3]
of Artin's Axioms, Section \ref{artin-section-axioms}.
We omit the verification of [-1] and axioms
[0], [1], [2], [3] correspond respectively to
Lemmas \ref{lemma-coherent-stack},
\ref{lemma-coherent-limits},
\ref{lemma-coherent-RS-star},
\ref{lemma-coherent-tangent-space}.
Condition (3) is Lemma \ref{lemma-coherent-existence}.
Condition (1) is Lemma \ref{lemma-coherent-diagonal}.

\medskip\noindent
It remains to show condition (4) which is openness of versality.
To see this we will use
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.
We have already seen that $\mathcal{X}$ has diagonal
representable by algebraic spaces, has (RS*), and is limit preserving
(see lemmas used above).
Hence we only need to see that $\mathcal{X}$ satisfies the strong
formal effectiveness formulated in
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.
This is Flatness on Spaces, Theorem \ref{spaces-flat-theorem-existence}
and the proof is complete.
\end{proof}









\section{The functor of quotients}
\label{section-functor-quotients}

\noindent
In this section we discuss some generalities regarding the functor
$Q_{\mathcal{F}/X/B}$ defined below.
The notation $\Quotfunctor_{\mathcal{F}/X/B}$ is reserved for a
subfunctor of $\text{Q}_{\mathcal{F}/X/B}$.
We urge the reader to skip this section on a first reading.

\begin{situation}
\label{situation-q}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
For any scheme $T$ over $B$ we will denote $X_T$ the base change of
$X$ to $T$ and $\mathcal{F}_T$ the pullback
of $\mathcal{F}$ via the projection morphism $X_T = X \times_B T \to X$.
Given such a $T$ we set
$$
\text{Q}_{\mathcal{F}/X/B}(T) =
\left\{
\begin{matrix}
\text{quotients }\mathcal{F}_T \to \mathcal{Q}\text{ where }
\mathcal{Q}\text{ is a}\\
\text{quasi-coherent }
\mathcal{O}_{X_T}\text{-module flat over }T
\end{matrix}
\right\}
$$
We identify quotients if they have the same kernel. Suppose
that $T' \to T$ is a morphism of schemes over $B$ and
$\mathcal{F}_T \to \mathcal{Q}$ is an element of
$\text{Q}_{\mathcal{F}/X/B}(T)$. Then the pullback
$\mathcal{Q}' = (X_{T'} \to X_T)^*\mathcal{Q}$ is a quasi-coherent
$\mathcal{O}_{X_{T'}}$-module flat over $T'$ by
Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-base-change-module-flat}.
Thus we obtain a functor
\begin{equation}
\label{equation-q}
\text{Q}_{\mathcal{F}/X/B} : (\Sch/B)^{opp} \longrightarrow \textit{Sets}
\end{equation}
This is the {\it functor of quotients of $\mathcal{F}/X/B$}.
We define a subfunctor
\begin{equation}
\label{equation-q-fp}
\text{Q}^{fp}_{\mathcal{F}/X/B} : (\Sch/B)^{opp} \longrightarrow \textit{Sets}
\end{equation}
which assigns to $T$ the subset of $\text{Q}_{\mathcal{F}/X/B}(T)$
consisting of those quotients $\mathcal{F}_T \to \mathcal{Q}$
such that $\mathcal{Q}$ is of finite presentation as an
$\mathcal{O}_{X_T}$-module. This is a subfunctor by
Properties of Spaces, Section
\ref{spaces-properties-section-properties-modules}.
\end{situation}

\noindent
In Situation \ref{situation-q} we sometimes think of
$\text{Q}_{\mathcal{F}/X/B}$ as a functor
$(\Sch/S)^{opp} \to \textit{Sets}$ endowed
with a morphism $\text{Q}_{\mathcal{F}/X/S} \to B$.
Namely, if $T$ is a scheme over $S$, then an element
of $\text{Q}_{\mathcal{F}/X/B}(T)$ is a pair $(h, \mathcal{Q})$
where $h$ a morphism $h : T \to B$
and $\mathcal{Q}$ is a $T$-flat quotient $\mathcal{F}_T \to \mathcal{Q}$
of finite presentation on $X_T = X \times_{B, h} T$. In particular, when we say
that $\text{Q}_{\mathcal{F}/X/S}$ is an algebraic space, we mean that the
corresponding functor $(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.
Similar remarks apply to $\text{Q}^{fp}_{\mathcal{F}/X/B}$.

\begin{remark}
\label{remark-q-base-change}
In Situation \ref{situation-q} let $B' \to B$ be a morphism of
algebraic spaces over $S$. Set $X' = X \times_B B'$ and denote
$\mathcal{F}'$ the pullback of $\mathcal{F}$ to $X'$.
Thus we have the functor $Q_{\mathcal{F}'/X'/B'}$ on
the category of schemes over $B'$. For a scheme $T$ over $B'$
it is clear that we have
$$
Q_{\mathcal{F}'/X'/B'}(T) = Q_{\mathcal{F}/X/B}(T)
$$
where on the right hand side we think of $T$ as a scheme over $B$
via the composition $T \to B' \to B$.
Similar remarks apply to $\text{Q}^{fp}_{\mathcal{F}/X/B}$.
These trivial remarks
will occasionally be useful to change the base algebraic space.
\end{remark}

\begin{remark}
\label{remark-q-sheaf}
Let $S$ be a scheme, $X$ an algebraic space over $S$, and $\mathcal{F}$
a quasi-coherent $\mathcal{O}_X$-module. Suppose that
$\{f_i : X_i \to X\}_{i \in I}$
is an fpqc covering and for each $i, j \in I$ we are given an fpqc covering
$\{X_{ijk} \to X_i \times_X X_j\}$. In this situation we have a bijection
$$
\left\{
\begin{matrix}
\text{quotients }\mathcal{F} \to \mathcal{Q}\text{ where } \\
\mathcal{Q}\text{ is a quasi-coherent }\\
\end{matrix}
\right\}
\longrightarrow
\left\{
\begin{matrix}
\text{families of quotients }f_i^*\mathcal{F} \to \mathcal{Q}_i
\text{ where } \\
\mathcal{Q}_i\text{ is quasi-coherent and }
\mathcal{Q}_i\text{ and }\mathcal{Q}_j\\
\text{ restrict to the same quotient on }X_{ijk}
\end{matrix}
\right\}
$$
Namely, let $(f_i^*\mathcal{F} \to \mathcal{Q}_i)_{i \in I}$
be an element of the right hand side. Then since
$\{X_{ijk} \to X_i \times_X X_j\}$ is an fpqc covering we see that
the pullbacks of $\mathcal{Q}_i$ and $\mathcal{Q}_j$ restrict
to the same quotient of the pullback of $\mathcal{F}$ to $X_i \times_X X_j$
(by fully faithfulness in
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}).
Hence we obtain a descent datum for quasi-coherent modules
with respect to $\{X_i \to X\}_{i \in I}$. By
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
we find a map of quasi-coherent $\mathcal{O}_X$-modules
$\mathcal{F} \to \mathcal{Q}$ whose restriction to $X_i$ recovers
the given maps $f_i^*\mathcal{F} \to \mathcal{Q}_i$.
Since the family of morphisms $\{X_i \to X\}$ is jointly surjective
and flat, for every point $x \in |X|$ there exists an $i$ and a point
$x_i \in |X_i|$ mapping to $x$. Note that the induced map on
local rings
$\mathcal{O}_{X, \overline{x}} \to \mathcal{O}_{X_i, \overline{x_i}}$
is faithfully flat, see
Morphisms of Spaces, Section \ref{spaces-morphisms-section-flat}.
Thus we see that $\mathcal{F} \to \mathcal{Q}$ is surjective.
\end{remark}

\begin{lemma}
\label{lemma-q-sheaf}
In Situation \ref{situation-q}. The functors
$\text{Q}_{\mathcal{F}/X/B}$ and
$\text{Q}^{fp}_{\mathcal{F}/X/B}$
satisfy the sheaf property for the fpqc topology.
\end{lemma}

\begin{proof}
Let $\{T_i \to T\}_{i \in I}$ be an fpqc covering of schemes over $S$.
Set $X_i = X_{T_i} = X \times_S T_i$ and $\mathcal{F}_i = \mathcal{F}_{T_i}$.
Note that $\{X_i \to X_T\}_{i \in I}$ is an fpqc covering of
$X_T$ (Topologies on Spaces, Lemma \ref{spaces-topologies-lemma-fpqc})
and that $X_{T_i \times_T T_{i'}} = X_i \times_{X_T} X_{i'}$.
Suppose that $\mathcal{F}_i \to \mathcal{Q}_i$ is a collection of
elements of $\text{Q}_{\mathcal{F}/X/B}(T_i)$ such that $\mathcal{Q}_i$
and $\mathcal{Q}_{i'}$ restrict to the same element of
$\text{Q}_{\mathcal{F}/X/B}(T_i \times_T T_{i'})$. By
Remark \ref{remark-q-sheaf}
we obtain a surjective map of quasi-coherent $\mathcal{O}_{X_T}$-modules
$\mathcal{F}_T \to \mathcal{Q}$ whose restriction to $X_i$ recovers
the given quotients.
By Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-permanence}
we see that $\mathcal{Q}$ is flat over $T$. Finally, in the case of
$\text{Q}^{fp}_{\mathcal{F}/X/B}$, i.e., if $\mathcal{Q}_i$ are
of finite presentation, then
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-finite-presentation-descends}
guarantees that $\mathcal{Q}$ is of finite presentation as an
$\mathcal{O}_{X_T}$-module.
\end{proof}

\noindent
Sanity check: $\text{Q}_{\mathcal{F}/X/B}$,
$\text{Q}^{fp}_{\mathcal{F}/X/B}$
play the same role among algebraic spaces
over $S$.

\begin{lemma}
\label{lemma-extend-q-to-spaces}
In Situation \ref{situation-q}. Let $T$ be an algebraic space over $S$.
We have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T,  \text{Q}_{\mathcal{F}/X/B}) =
\left\{
\begin{matrix}
(h, \mathcal{F}_T \to \mathcal{Q}) \text{ where }
h : T \to B \text{ and}\\
\mathcal{Q}\text{ is quasi-coherent and flat over }T
\end{matrix}
\right\}
$$
where $\mathcal{F}_T$ denotes the pullback of $\mathcal{F}$
to the algebraic space $X \times_{B, h} T$. Similarly, we have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T,  \text{Q}^{fp}_{\mathcal{F}/X/B}) =
\left\{
\begin{matrix}
(h, \mathcal{F}_T \to \mathcal{Q}) \text{ where }
h : T \to B \text{ and}\\
\mathcal{Q}\text{ is of finite presentation and flat over }T
\end{matrix}
\right\}
$$
\end{lemma}

\begin{proof}
Choose a scheme $U$ and a surjective \'etale morphism $p : U \to T$.
Let $R = U \times_T U$ with projections $t, s : R \to U$.

\medskip\noindent
Let $v : T \to \text{Q}_{\mathcal{F}/X/B}$
be a natural transformation. Then $v(p)$ corresponds to a pair
$(h_U, \mathcal{F}_U \to \mathcal{Q}_U)$ over $U$.
As $v$ is a transformation of functors we see
that the pullbacks of $(h_U, \mathcal{F}_U \to \mathcal{Q}_U)$
by $s$ and $t$ agree.
Since $T = U/R$ (Spaces, Lemma \ref{spaces-lemma-space-presentation}),
we obtain a morphism $h : T \to B$ such that
$h_U = h \circ p$. By Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
the quotient $\mathcal{Q}_U$ descends to a quotient
$\mathcal{F}_T \to \mathcal{Q}$ over $X_T$.
Since $U \to T$ is surjective and flat, it follows from
Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-permanence}
that $\mathcal{Q}$ is flat over $T$.

\medskip\noindent
Conversely, let $(h, \mathcal{F}_T \to \mathcal{Q})$ be a pair over $T$.
Then we get a natural transformation
$v : T \to \text{Q}_{\mathcal{F}/X/B}$
by sending a morphism $a : T' \to T$ where $T'$ is a scheme
to $(h \circ a, \mathcal{F}_{T'} \to a^*\mathcal{Q})$.
We omit the verification that the construction
of this and the previous paragraph are mutually inverse.

\medskip\noindent
In the case of $\text{Q}^{fp}_{\mathcal{F}/X/B}$ we
add: given a morphism $h : T \to B$, a quasi-coherent sheaf
on $X_T$ is of finite presentation as an $\mathcal{O}_{X_T}$-module
if and only if the pullback to $X_U$ is of finite presentation as an
$\mathcal{O}_{X_U}$-module. This follows from the fact that
$X_U \to X_T$ is surjective and \'etale and
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-finite-presentation-descends}.
\end{proof}

\begin{lemma}
\label{lemma-q-sheaf-in-X}
In Situation \ref{situation-q} let $\{X_i \to X\}_{i \in I}$ be an fpqc
covering and for each $i, j \in I$ let $\{X_{ijk} \to X_i \times_X X_j\}$
be an fpqc covering. Denote $\mathcal{F}_i$, resp.\ $\mathcal{F}_{ijk}$
the pullback of $\mathcal{F}$ to $X_i$, resp.\ $X_{ijk}$. For every scheme
$T$ over $B$ the diagram
$$
\xymatrix{
Q_{\mathcal{F}/X/B}(T) \ar[r] &
\prod\nolimits_i
Q_{\mathcal{F}_i/X_i/B}(T)
\ar@<1ex>[r]^-{\text{pr}_0^*} \ar@<-1ex>[r]_-{\text{pr}_1^*}
&
\prod\nolimits_{i, j, k}
Q_{\mathcal{F}_{ijk}/X_{ijk}/B}(T)
}
$$
presents the first arrow as the equalizer of the other two.
The same is true for the functor $\text{Q}^{fp}_{\mathcal{F}/X/B}$.
\end{lemma}

\begin{proof}
Let $\mathcal{F}_{i, T} \to \mathcal{Q}_i$ be an element in the equalizer
of $\text{pr}_0^*$ and $\text{pr}_1^*$. By Remark \ref{remark-q-sheaf}
we obtain a surjection $\mathcal{F}_T \to \mathcal{Q}$ of quasi-coherent
$\mathcal{O}_{X_T}$-modules whose restriction to $X_{i, T}$ recovers
$\mathcal{F}_i \to \mathcal{Q}_i$.
By Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-permanence}
we see that $\mathcal{Q}$ is flat over $T$ as desired.
In the case of the functor $\text{Q}^{fp}_{\mathcal{F}/X/B}$, i.e.,
if $\mathcal{Q}_i$ is of finite presentation, then
$\mathcal{Q}$ is of finite presentation too by
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-finite-presentation-descends}.
\end{proof}

\begin{lemma}
\label{lemma-q-limit-preserving}
In Situation \ref{situation-q} assume also that
(a) $f$ is quasi-compact and quasi-separated and
(b) $\mathcal{F}$ is of finite presentation.
Then the functor $\text{Q}^{fp}_{\mathcal{F}/X/B}$
is limit preserving in the following sense: If $T = \lim T_i$ is a
directed limit of affine schemes over $B$, then
$\text{Q}^{fp}_{\mathcal{F}/X/B}(T) =
\colim \text{Q}^{fp}_{\mathcal{F}/X/B}(T_i)$.
\end{lemma}

\begin{proof}
Let $T = \lim T_i$ be as in the statement of the lemma.
Choose $i_0 \in I$ and replace $I$ by $\{i \in I \mid i \geq i_0\}$.
We may set $B = S = T_{i_0}$ and we may replace $X$ by $X_{T_0}$
and $\mathcal{F}$ by the pullback to $X_{T_0}$. Then
$X_T = \lim X_{T_i}$, see
Limits of Spaces, Lemma
\ref{spaces-limits-lemma-directed-inverse-system-has-limit}.
Let $\mathcal{F}_T \to \mathcal{Q}$ be an element of
$\text{Q}^{fp}_{\mathcal{F}/X/B}(T)$. By
Limits of Spaces, Lemma
\ref{spaces-limits-lemma-descend-modules-finite-presentation}
there exists an $i$ and a map $\mathcal{F}_{T_i} \to \mathcal{Q}_i$
of $\mathcal{O}_{X_{T_i}}$-modules of finite presentation whose
pullback to $X_T$ is the given quotient map.

\medskip\noindent
We still have to check that, after possibly increasing $i$, the map
$\mathcal{F}_{T_i} \to \mathcal{Q}_i$ is surjective and $\mathcal{Q}_i$
is flat over $T_i$. To do this, choose an affine scheme $U$ and a
surjective \'etale morphism $U \to X$ (see Properties of Spaces,
Lemma \ref{spaces-properties-lemma-quasi-compact-affine-cover}).
We may check surjectivity and flatness over $T_i$ after pulling
back to the \'etale cover $U_{T_i} \to X_{T_i}$ (by definition).
This reduces us to the case where $X = \Spec(B_0)$ is an affine scheme of
finite presentation over $B = S = T_0 = \Spec(A_0)$.
Writing $T_i = \Spec(A_i)$, then $T = \Spec(A)$ with $A = \colim A_i$
we have reached the following algebra problem. Let $M_i \to N_i$
be a map of finitely presented $B_0 \otimes_{A_0} A_i$-modules
such that $M_i \otimes_{A_i} A \to N_i \otimes_{A_i} A$ is surjective
and $N_i \otimes_{A_i} A$ is flat over $A$. Show that for some $i' \geq i$
$M_i \otimes_{A_i} A_{i'} \to N_i \otimes_{A_i} A_{i'}$ is surjective
and $N_i \otimes_{A_i} A_{i'}$ is flat over $A$.
The first follows from
Algebra, Lemma \ref{algebra-lemma-module-map-property-in-colimit}
and the second from
Algebra, Lemma \ref{algebra-lemma-flat-finite-presentation-limit-flat}.
\end{proof}

\begin{lemma}
\label{lemma-q-RS-star}
In Situation \ref{situation-q}. Let
$$
\xymatrix{
Z \ar[r] \ar[d] & Z' \ar[d] \\
Y \ar[r] & Y'
}
$$
be a pushout in the category of schemes over $B$ where
$Z \to Z'$ is a thickening and $Z \to Y$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the natural map
$$
Q_{\mathcal{F}/X/B}(Y') \longrightarrow
Q_{\mathcal{F}/X/B}(Y) \times_{Q_{\mathcal{F}/X/B}(Z)} Q_{\mathcal{F}/X/B}(Z')
$$
is bijective. If $X \to B$ is locally of finite presentation, then
the same thing is true for $Q^{fp}_{\mathcal{F}/X/B}$.
\end{lemma}

\begin{proof}
Let us construct an inverse map. Namely, suppose we have
$\mathcal{F}_Y \to \mathcal{A}$,
$\mathcal{F}_{Z'} \to \mathcal{B}'$, and an isomorphism
$\mathcal{A}|_{X_Z} \to \mathcal{B}'|_{X_Z}$
compatible with the given surjections.
Then we apply Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-space-over-pushout-flat-modules}
to get a quasi-coherent module $\mathcal{A}'$ on $X_{Y'}$
flat over $Y'$. Since this sheaf is constructed as a fibre product
(see proof of cited lemma) there is a canonical map
$\mathcal{F}_{Y'} \to \mathcal{A}'$. That this map is surjective
can be seen because it factors as
$$
\begin{matrix}
\mathcal{F}_{Y'} \\
\downarrow \\
(X_Y \to X_{Y'})_*\mathcal{F}_Y
\times_{(X_Z \to X_{Y'})_*\mathcal{F}_Z}
(X_{Z'} \to X_{Y'})_*\mathcal{F}_{Z'} \\
\downarrow \\
\mathcal{A}' =
(X_Y \to X_{Y'})_*\mathcal{A}
\times_{(X_Z \to X_{Y'})_*\mathcal{A}|_{X_Z}}
(X_{Z'} \to X_{Y'})_*\mathcal{B}'
\end{matrix}
$$
and the first arrow is surjective by
More on Algebra, Lemma \ref{more-algebra-lemma-module-over-fibre-product-bis}
and the second by
More on Algebra, Lemma
\ref{more-algebra-lemma-surjection-module-over-fibre-product}.

\medskip\noindent
In the case of $Q^{fp}_{\mathcal{F}/X/B}$ all we have to show is that
the construction above produces a finitely presented module.
This is explained in
More on Algebra, Remark
\ref{more-algebra-remark-relative-modules-over-fibre-product}
in the commutative algebra setting. The current case of modules
over algebraic spaces follows from this
by \'etale localization.
\end{proof}

\begin{remark}[Obstructions for quotients]
\label{remark-q-obs}
In Situation \ref{situation-q} {\bf assume} that $\mathcal{F}$ is flat
over $B$. Let $T \subset T'$ be an first order
thickening of schemes over $B$ with ideal sheaf $\mathcal{J}$. Then
$X_T \subset X_{T'}$ is a first order thickening of algebraic spaces
whose ideal sheaf $\mathcal{I}$ is a quotient of $f_T^*\mathcal{J}$.
We will think of sheaves on $X_{T'}$, resp.\ $T'$ as sheaves on
$X_T$, resp.\ $T$ using the fundamental equivalence described in
More on Morphisms of Spaces, Section
\ref{spaces-more-morphisms-section-thickenings}.
Let
$$
0 \to \mathcal{K} \to \mathcal{F}_T \to \mathcal{Q} \to 0
$$
define an element $x$ of $Q_{\mathcal{F}/X/B}(T)$. Since $\mathcal{F}_{T'}$
is flat over $T'$ we have a short exact sequence
$$
0 \to f_T^*\mathcal{J} \otimes_{\mathcal{O}_{X_T}} \mathcal{F}_T
\xrightarrow{i} \mathcal{F}_{T'} \xrightarrow{\pi} \mathcal{F}_T \to 0
$$
and we have
$f_T^*\mathcal{J} \otimes_{\mathcal{O}_{X_T}} \mathcal{F}_T =
\mathcal{I} \otimes_{\mathcal{O}_{X_T}} \mathcal{F}_T$, see
Deformation Theory, Lemma \ref{defos-lemma-deform-module-ringed-topoi}.
Let us use the abbreviation
$
f_T^*\mathcal{J} \otimes_{\mathcal{O}_{X_T}} \mathcal{G} =
\mathcal{G} \otimes_{\mathcal{O}_T} \mathcal{J}
$
for an $\mathcal{O}_{X_T}$-module $\mathcal{G}$.
Since $\mathcal{Q}$ is flat over $T$, we obtain a short exact sequence
$$
0 \to
\mathcal{K} \otimes_{\mathcal{O}_T} \mathcal{J} \to
\mathcal{F}_T \otimes_{\mathcal{O}_T} \mathcal{J} \to
\mathcal{Q} \otimes_{\mathcal{O}_T} \mathcal{J} \to
\to 0
$$
Combining the above we obtain an canonical extension
$$
0 \to \mathcal{Q} \otimes_{\mathcal{O}_T} \mathcal{J} \to
\pi^{-1}(\mathcal{K})/i(\mathcal{K} \otimes_{\mathcal{O}_T} \mathcal{J}) \to
\mathcal{K} \to 0
$$
of $\mathcal{O}_{X_T}$-modules. This defines a canonical class
$$
o_x(T') \in
\Ext^1_{\mathcal{O}_{X_T}}(\mathcal{K},
\mathcal{Q} \otimes_{\mathcal{O}_T} \mathcal{J})
$$
If $o_x(T')$ is zero, then we obtain a splitting of the short
exact sequence defining it, in other words, we obtain a
$\mathcal{O}_{X_{T'}}$-submodule
$\mathcal{K}' \subset \pi^{-1}(\mathcal{K})$ sitting in a short
exact sequence
$0 \to \mathcal{K} \otimes_{\mathcal{O}_T} \mathcal{J} \to
\mathcal{K}' \to \mathcal{K} \to 0$.
Then it follows from the lemma reference above that
$\mathcal{Q}' = \mathcal{F}_{T'}/\mathcal{K}'$
is a lift of $x$ to an element of $Q_{\mathcal{F}/X/B}(T')$.
Conversely, the reader sees that the existence of
a lift implies that $o_x(T')$ is zero. Moreover, if
$x \in Q_{\mathcal{F}/X/B}^{fp}(T)$, then automatically
$x' \in Q_{\mathcal{F}/X/B}^{fp}(T')$ by
Deformation Theory, Lemma \ref{defos-lemma-deform-fp-module-ringed-topoi}.
If we ever need this
remark we will turn this remark into a lemma, precisely formulate
the result and give a detailed proof (in fact, all of the above
works in the setting of arbitrary ringed topoi).
\end{remark}

\begin{remark}[Deformations of quotients]
\label{remark-q-defos}
In Situation \ref{situation-q} {\bf assume} that $\mathcal{F}$ is flat
over $B$. We continue the discussion of Remark \ref{remark-q-obs}.
Assume $o_x(T') = 0$. Then we claim that the set of lifts
$x' \in Q_{\mathcal{F}/X/B}(T')$ is a principal homogeneous space
under the group
$$
\Hom_{\mathcal{O}_{X_T}}(\mathcal{K},
\mathcal{Q} \otimes_{\mathcal{O}_T} \mathcal{J})
$$
Namely, given any $\mathcal{F}_{T'} \to \mathcal{Q}'$ flat over $T'$
lifting the quotient $\mathcal{Q}$ we obtain a commutative diagram
with exact rows and columns
$$
\xymatrix{
& 0 \ar[d] & 0 \ar[d] & 0 \ar[d] \\
0 \ar[r] &
\mathcal{K} \otimes \mathcal{J} \ar[r] \ar[d] &
\mathcal{F}_T \otimes \mathcal{J} \ar[r] \ar[d] &
\mathcal{Q} \otimes \mathcal{J} \ar[r] \ar[d] &
0 \\
0 \ar[r] &
\mathcal{K}' \ar[r] \ar[d] &
\mathcal{F}_{T'} \ar[r] \ar[d] &
\mathcal{Q}' \ar[r] \ar[d] &
0 \\
0 \ar[r] &
\mathcal{K} \ar[d] \ar[r] &
\mathcal{F}_T \ar[d] \ar[r] &
\mathcal{Q} \ar[d] \ar[r] &
0 \\
& 0 & 0 & 0
}
$$
(to see this use the observations made in the previous remark).
Given a map $\varphi : \mathcal{K} \to \mathcal{Q} \otimes \mathcal{J}$
we can consider the subsheaf $\mathcal{K}'_\varphi \subset \mathcal{F}_{T'}$
consisting of those local sections $s$
whose image in $\mathcal{F}_T$ is a local section $k$ of $\mathcal{K}$
and whose image in $\mathcal{Q}'$ is the local section $\varphi(k)$ of
$\mathcal{Q} \otimes \mathcal{J}$. Then set
$\mathcal{Q}'_\varphi = \mathcal{F}_{T'}/\mathcal{K}'_\varphi$.
Conversely, any second lift of $x$ corresponds to one of the
qotients constructed in this manner. If we ever need this
remark we will turn this remark into a lemma, precisely formulate
the result and give a detailed proof (in fact, all of the above
works in the setting of arbitrary ringed topoi).
\end{remark}










\section{The Quot functor}
\label{section-quot}

\noindent
In this section we prove the Quot functor is an algebraic space.

\begin{situation}
\label{situation-quot}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of
algebraic spaces over $S$. Assume that $f$ is of finite presentation.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
For any scheme $T$ over $B$ we will denote $X_T$ the base change of
$X$ to $T$ and $\mathcal{F}_T$ the pullback
of $\mathcal{F}$ via the projection morphism $X_T = X \times_S T \to X$.
Given such a $T$ we set
$$
\Quotfunctor_{\mathcal{F}/X/B}(T) =
\left\{
\begin{matrix}
\text{quotients }\mathcal{F}_T \to \mathcal{Q}\text{ where }
\mathcal{Q}\text{ is a quasi-coherent }\\
\mathcal{O}_{X_T}\text{-module of finite presentation, flat over }T\\
\text{with support proper over }T
\end{matrix}
\right\}
$$
By Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-base-change-module-support-proper-over-base}
this is a subfunctor of the functor $Q^{fp}_{\mathcal{F}/X/B}$
we discussed in Section \ref{section-functor-quotients}.
Thus we obtain a functor
\begin{equation}
\label{equation-quot}
\Quotfunctor_{\mathcal{F}/X/B} : (\Sch/B)^{opp} \longrightarrow \textit{Sets}
\end{equation}
This is the {\it Quot functor} associated to $\mathcal{F}/X/B$.
\end{situation}

\noindent
In Situation \ref{situation-quot} we sometimes think of
$\Quotfunctor_{\mathcal{F}/X/B}$ as a functor
$(\Sch/S)^{opp} \to \textit{Sets}$ endowed
with a morphism $\Quotfunctor_{\mathcal{F}/X/B} \to B$.
Namely, if $T$ is a scheme over $S$, then an element
of $\Quotfunctor_{\mathcal{F}/X/B}(T)$ is a pair $(h, \mathcal{Q})$
where $h$ is a morphism $h : T \to B$
and $Q$ is a finitely presented, $T$-flat quotient
$\mathcal{F}_T \to \mathcal{Q}$ on $X_T = X \times_{B, h} T$
with support proper over $T$. In particular, when we say
that $\Quotfunctor_{\mathcal{F}/X/B}$ is an algebraic space, we mean that the
corresponding functor $(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\begin{lemma}
\label{lemma-quot-sheaf}
In Situation \ref{situation-quot}. The functor $\Quotfunctor_{\mathcal{F}/X/B}$
satisfies the sheaf property for the fpqc topology.
\end{lemma}

\begin{proof}
In Lemma \ref{lemma-q-sheaf} we have seen that the functor
$\text{Q}^{fp}_{\mathcal{F}/X/S}$ is a sheaf. Recall that for a
scheme $T$ over $S$ the subset
$\Quotfunctor_{\mathcal{F}/X/S}(T) \subset \text{Q}_{\mathcal{F}/X/S}(T)$
picks out those quotients whose support is proper over $T$.
This defines a subsheaf by the result of
Descent on Spaces, Lemma \ref{spaces-descent-lemma-descending-property-proper}
combined with
Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-pullback-support}
which shows that taking scheme theoretic support commutes
with flat base change.
\end{proof}

\noindent
Sanity check: $\Quotfunctor_{\mathcal{F}/X/B}$
plays the same role among algebraic spaces
over $S$.

\begin{lemma}
\label{lemma-extend-quot-to-spaces}
In Situation \ref{situation-quot}. Let $T$ be an algebraic space over $S$.
We have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T,  \Quotfunctor_{\mathcal{F}/X/B}) =
\left\{
\begin{matrix}
(h, \mathcal{F}_T \to \mathcal{Q}) \text{ where }
h : T \to B \text{ and}\\
\mathcal{Q}\text{ is of finite presentation and}\\
\text{flat over }T\text{ with support proper over }T
\end{matrix}
\right\}
$$
where $\mathcal{F}_T$ denotes the pullback of $\mathcal{F}$
to the algebraic space $X \times_{B, h} T$.
\end{lemma}

\begin{proof}
Observe that the left and right hand side of the equality are
subsets of the left and right hand side of the second equality in
Lemma \ref{lemma-extend-q-to-spaces}.
To see that these subsets correspond under
the identification given in the proof of that lemma
it suffices to show: given $h : T \to B$,
a surjective \'etale morphism $U \to T$,
a finite type quasi-coherent $\mathcal{O}_{X_T}$-module $\mathcal{Q}$
the following are equivalent
\begin{enumerate}
\item the scheme theoretic support of $\mathcal{Q}$ is proper
over $T$, and
\item the scheme theoretic support of $(X_U \to X_T)^*\mathcal{Q}$
is proper over $U$.
\end{enumerate}
This follows from
Descent on Spaces, Lemma \ref{spaces-descent-lemma-descending-property-proper}
combined with
Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-flat-pullback-support}
which shows that taking scheme theoretic support commutes
with flat base change.
\end{proof}

\begin{proposition}
\label{proposition-quot}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic
spaces over $S$. Let $\mathcal{F}$ be a quasi-coherent sheaf
on $X$. If $f$ is of finite presentation and separated, then
$\Quotfunctor_{\mathcal{F}/X/B}$
is an algebraic space. If $\mathcal{F}$ is of finite presentation,
then $\Quotfunctor_{\mathcal{F}/X/B} \to B$ is locally of finite presentation.
\end{proposition}

\begin{proof}
By Lemma \ref{lemma-quot-sheaf}
we have that $\Quotfunctor_{\mathcal{F}/X/B}$ is a sheaf in the
fppf topology. Let $\textit{Quot}_{\mathcal{F}/X/B}$ be the stack in
groupoids corresponding to $\Quotfunctor_{\mathcal{F}/X/S}$, see
Algebraic Stacks, Section \ref{algebraic-section-split}.
By Algebraic Stacks, Proposition
\ref{algebraic-proposition-algebraic-stack-no-automorphisms}
it suffices to show that $\textit{Quot}_{\mathcal{F}/X/B}$
is an algebraic stack.
Consider the $1$-morphism of stacks in groupoids
$$
\textit{Quot}_{\mathcal{F}/X/S}
\longrightarrow
\Cohstack_{X/B}
$$
on $(\Sch/S)_{fppf}$ which associates to the quotient
$\mathcal{F}_T \to \mathcal{Q}$ the coherent sheaf $\mathcal{Q}$.
By Theorem \ref{theorem-coherent-algebraic-general} we know that
$\Cohstack_{X/B}$ is an algebraic stack.
By Algebraic Stacks, Lemma
\ref{algebraic-lemma-representable-morphism-to-algebraic}
it suffices to show that this $1$-morphism is representable
by algebraic spaces.

\medskip\noindent
Let $T$ be a scheme over $S$ and let the object $(h, \mathcal{G})$ of
$\Cohstack_{X/B}$ over $T$ correspond
to a $1$-morphism $\xi : (\Sch/T)_{fppf} \to \Cohstack_{X/B}$.
The $2$-fibre product
$$
\mathcal{Z} =
(\Sch/T)_{fppf}
\times_{\xi, \Cohstack_{X/B}}
\textit{Quot}_{\mathcal{F}/X/S}
$$
is a stack in setoids, see
Stacks, Lemma \ref{stacks-lemma-2-fibre-product-gives-stack-in-setoids}.
The corresponding sheaf of sets (i.e., functor, see
Stacks, Lemmas
\ref{stacks-lemma-2-fibre-product-gives-stack-in-setoids} and
\ref{stacks-lemma-when-stack-in-sets}) assigns to a scheme
$T'/T$ the set of surjections $u : \mathcal{F}_{T'} \to \mathcal{G}_{T'}$
of quasi-coherent modules on $X_{T'}$. Thus we see that
$\mathcal{Z}$ is representable by an open subspace
(by Flatness on Spaces, Lemma \ref{spaces-flat-lemma-F-surj-open})
of the algebraic space
$\mathit{Hom}(\mathcal{F}_T, \mathcal{G})$ from
Proposition \ref{proposition-hom}.
\end{proof}

\begin{remark}[Quot via Artin's axioms]
\label{remark-quot-via-artins-axioms}
Let $S$ be a Noetherian scheme all of whose local rings are G-rings.
Let $X$ be an algebraic space over $S$ whose structure morphism
$f : X \to S$ is of finite presentation and separated.
Let $\mathcal{F}$ be a finitely presented quasi-coherent sheaf
on $X$ flat over $S$. In this remark we sketch how one can
use Artin's axioms to prove that $\Quotfunctor_{\mathcal{F}/X/S}$
is an algebraic space locally of finite presentation over $S$
and avoid using the algebraicity of the stack of coherent sheaves
as was done in the proof of Proposition \ref{proposition-quot}.

\medskip\noindent
We check the conditions listed in Artin's Axioms, Proposition
\ref{artin-proposition-spaces-diagonal-representable}.
Representability of the diagonal of $\Quotfunctor_{\mathcal{F}/X/S}$
can be seen as follows: suppose we have two quotients
$\mathcal{F}_T \to \mathcal{Q}_i$, $i = 1, 2$. Denote
$\mathcal{K}_1$ the kernel of the first one. Then we have
to show that the locus of $T$ over which
$u : \mathcal{K}_1 \to \mathcal{Q}_2$ becomes zero is representable.
This follows for example from Flatness on Spaces, Lemma
\ref{spaces-flat-lemma-F-zero-closed-proper}
or from a discussion of the $\mathit{Hom}$ sheaf earlier
in this chapter. Axioms [0] (sheaf), [1] (limits), [2] (Rim-Schlessinger)
follow from Lemmas \ref{lemma-quot-sheaf},
\ref{lemma-q-limit-preserving}, and \ref{lemma-q-RS-star}
(plus some extra work to deal with the properness condition).
Axiom [3] (finite dimensionality of tangent spaces)
follows from the description of the infinitesimal
deformations in Remark \ref{remark-q-defos}
and finiteness of cohomology of coherent sheaves on proper
algebraic spaces over fields (Cohomology of Spaces, Lemma
\ref{spaces-cohomology-lemma-proper-pushforward-coherent}).
Axiom [4] (effectiveness of formal objects)
follows from Grothendieck's existence theorem
(More on Morphisms of Spaces, Theorem
\ref{spaces-more-morphisms-theorem-grothendieck-existence}).
As usual, the trickiest to verify is axiom [5] (openness of versality).
One can for example use the obstruction theory described
in Remark \ref{remark-q-obs} and the description of
deformations in Remark \ref{remark-q-defos}
to do this using the criterion in
Artin's Axioms, Lemma \ref{artin-lemma-get-openness-obstruction-theory}.
Please compare with the second proof of
Lemma \ref{lemma-coherent-defo-thy}.
\end{remark}









\section{The Hilbert functor}
\label{section-hilb}

\noindent
In this section we prove the Hilb functor is an algebraic space.

\begin{situation}
\label{situation-hilb}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of
algebraic spaces over $S$. Assume that $f$ is of finite presentation.
For any scheme $T$ over $B$ we will denote $X_T$ the base change of
$X$ to $T$. Given such a $T$ we set
$$
\Hilbfunctor_{X/B}(T) =
\left\{
\begin{matrix}
\text{closed subspaces }Z \subset X_T\text{ such that }Z \to T\\
\text{is of finite presentation, flat, and proper}
\end{matrix}
\right\}
$$
Since base change preserves the required properties
(Spaces, Lemma \ref{spaces-lemma-base-change-immersions} and
Morphisms of Spaces, Lemmas
\ref{spaces-morphisms-lemma-base-change-finite-presentation},
\ref{spaces-morphisms-lemma-base-change-flat}, and
\ref{spaces-morphisms-lemma-base-change-proper})
we obtain a functor
\begin{equation}
\label{equation-hilb}
\Hilbfunctor_{X/B} : (\Sch/B)^{opp} \longrightarrow \textit{Sets}
\end{equation}
This is the {\it Hilbert functor} associated to $X/B$.
\end{situation}

\noindent
In Situation \ref{situation-hilb} we sometimes think of $\Hilbfunctor_{X/B}$
as a functor $(\Sch/S)^{opp} \to \textit{Sets}$ endowed with a morphism
$\Hilbfunctor_{X/S} \to B$. Namely, if $T$ is a scheme over $S$, then an element
of $\Hilbfunctor_{X/B}(T)$ is a pair $(h, Z)$
where $h$ is a morphism $h : T \to B$
and $Z \subset X_T = X \times_{B, h} T$
is a closed subscheme, flat, proper, and of finite
presentation over $T$. In particular, when we say
that $\Hilbfunctor_{X/B}$ is an algebraic space, we mean that the
corresponding functor $(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\medskip\noindent
Of course the Hilbert functor is just a special case of the
Quot functor.

\begin{lemma}
\label{lemma-hilb-is-quot}
In Situation \ref{situation-hilb} we have
$\Hilbfunctor_{X/B} = \Quotfunctor_{\mathcal{O}_X/X/B}$.
\end{lemma}

\begin{proof}
Let $T$ be a scheme over $B$. Given an element
$Z \in \Hilbfunctor_{X/B}(T)$ we can consider the
quotient $\mathcal{O}_{X_T} \to i_*\mathcal{O}_Z$
where $i : Z \to X_T$ is the inclusion morphism.
Note that $i_*\mathcal{O}_Z$ is quasi-coherent.
Since $Z \to T$ and $X_T \to T$ are of finite presentation,
we see that $i$ is of finite presentation (Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-finite-presentation-permanence}), hence
$i_*\mathcal{O}_Z$ is an $\mathcal{O}_{X_T}$-module of
finite presentation (Descent on Spaces, Lemma
\ref{spaces-descent-lemma-finite-finitely-presented-module}).
Since $Z \to T$ is proper we see that $i_*\mathcal{O}_Z$
has support proper over $T$ (as defined in
Derived Categories of Spaces, Section
\ref{spaces-perfect-section-proper-over-base}).
Since $\mathcal{O}_Z$ is flat
over $T$ and $i$ is affine, we see that $i_*\mathcal{O}_Z$
is flat over $T$ (small argument omitted). Hence
$\mathcal{O}_{X_T} \to i_*\mathcal{O}_Z$
is an element of $\Quotfunctor_{\mathcal{O}_X/X/B}(T)$.

\medskip\noindent
Conversely, given an element $\mathcal{O}_{X_T} \to \mathcal{Q}$
of $\Quotfunctor_{\mathcal{O}_X/X/B}(T)$, we can consider
the closed immersion $i : Z \to X_T$ corresponding to
the quasi-coherent ideal sheaf
$\mathcal{I} = \Ker(\mathcal{O}_{X_T} \to \mathcal{Q})$
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-closed-immersion-ideals}).
By construction of $Z$ we see that $\mathcal{Q} = i_*\mathcal{O}_Z$.
Then we can read the arguments given above backwards to see
that $Z$ defines an element of $\Hilbfunctor_{X/B}(T)$.
For example, $\mathcal{I}$ is quasi-coherent of finite type
(Modules on Sites, Lemma
\ref{sites-modules-lemma-kernel-surjection-finite-onto-finite-presentation})
hence $i : Z \to X_T$ is of finite presentation
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-closed-immersion-finite-presentation})
hence $Z \to T$ is of finite presentation
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-composition-finite-presentation}).
Properness of $Z \to T$ follows from the discussion in
Derived Categories of Spaces, Section
\ref{spaces-perfect-section-proper-over-base}.
Flatness of $Z \to T$ follows from flatness of $\mathcal{Q}$ over $T$.

\medskip\noindent
We omit the (immediate) verification that the two constructions given
above are mutually inverse.
\end{proof}

\noindent
Sanity check: $\Hilbfunctor_{X/B}$
sheaf plays the same role among algebraic spaces over $S$.

\begin{lemma}
\label{lemma-extend-hilb-to-spaces}
In Situation \ref{situation-hilb}. Let $T$ be an algebraic space over $S$.
We have
$$
\Mor_{\Sh((\Sch/S)_{fppf})}(T, \Hilbfunctor_{X/B}) =
\left\{
\begin{matrix}
(h, Z)\text{ where }h : T \to B,\ Z \subset X_T \\
\text{finite presentation, flat, proper over }T
\end{matrix}
\right\}
$$
where $X_T = X \times_{B, h} T$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-hilb-is-quot}
we have $\Hilbfunctor_{X/B} = \Quotfunctor_{\mathcal{O}_X/X/B}$.
Thus we can apply Lemma \ref{lemma-extend-quot-to-spaces}
to see that the left hand side is bijective with the set
of surjections $\mathcal{O}_{X_T} \to \mathcal{Q}$
which are finitely presented, flat over $T$, and
have support proper over $T$. Arguing exactly as in the
proof of Lemma \ref{lemma-hilb-is-quot}
we see that such quotients correspond
exactly to the closed immersions $Z \to X_T$ such that
$Z \to T$ is proper, flat, and of finite presentation.
\end{proof}

\begin{proposition}
\label{proposition-hilb}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic
spaces over $S$. If $f$ is of finite presentation and separated, then
$\Hilbfunctor_{X/B}$ is an algebraic space locally of finite
presentation over $B$.
\end{proposition}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-hilb-is-quot}
and Proposition \ref{proposition-quot}.
\end{proof}






\section{The Picard stack}
\label{section-picard-stack}

\noindent
The Picard stack for a morphism of algebraic spaces was introduced
in Examples of Stacks, Section \ref{examples-stacks-section-picard-stack}.
We will deduce it is an open substack of the stack of coherent sheaves
(in good cases) from the following lemma.

\begin{lemma}
\label{lemma-picard-stack-open-in-coh}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$ which is flat, of finite presentation, and proper.
The natural map
$$
\Picardstack_{X/B} \longrightarrow \Cohstack_{X/B}
$$
is representable by open immersions.
\end{lemma}

\begin{proof}
Observe that the map simply sends a triple $(T, g, \mathcal{L})$
as in Examples of Stacks, Section \ref{examples-stacks-section-picard-stack}
to the same triple $(T, g, \mathcal{L})$ but where now we view
this as a triple of the kind described in
Situation \ref{situation-coherent}.
This works because the invertible $\mathcal{O}_{X_T}$-module
$\mathcal{L}$ is certainly a finitely presented $\mathcal{O}_{X_T}$-module,
it is flat over $T$ because $X_T \to T$ is flat, and the support is
proper over $T$ as $X_T \to T$ is proper
(Morphisms of Spaces, Lemmas \ref{spaces-morphisms-lemma-base-change-flat}
and \ref{spaces-morphisms-lemma-base-change-proper}).
Thus the statement makes sense.

\medskip\noindent
Having said this, it is clear that the content of the lemma is the
following: given an object $(T, g, \mathcal{F})$ of
$\Cohstack_{X/B}$ there is an open subscheme $U \subset T$
such that for a morphism of schemes $T' \to T$ the following
are equivalent
\begin{enumerate}
\item[(a)] $T' \to T$ factors through $U$,
\item[(b)] the pullback $\mathcal{F}_{T'}$ of
$\mathcal{F}$ by $X_{T'} \to X_T$ is invertible.
\end{enumerate}
Let $W \subset |X_T|$ be the set of points $x \in |X_T|$
such that $\mathcal{F}$ is locally free in a neighbourhood of $x$. By
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-finite-free-open}.
$W$ is open and formation
of $W$ commutes with arbitrary base change.
Clearly, if $T' \to T$ satisfies (b), then $|X_{T'}| \to |X_T|$
maps into $W$. Hence we may replace $T$ by the open
$T \setminus f_T(|X_T| \setminus W)$ in order
to construct $U$. After doing so we reach the situation
where $\mathcal{F}$ is finite locally free.
In this case we get a disjoint union decomposition
$X_T = X_0 \amalg X_1 \amalg X_2 \amalg \ldots$
into open and closed subspaces such that the restriction of
$\mathcal{F}$ is locally free of rank $i$ on $X_i$. Then clearly
$$
U = T \setminus f_T(|X_0| \cup |X_2| \cup |X_3| \cup \ldots )
$$
works. (Note that if we assume that $T$ is quasi-compact, then
$X_T$ is quasi-compact hence only a finite number of $X_i$
are nonempty and so $U$ is indeed open.)
\end{proof}

\begin{proposition}
\label{proposition-pic}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic
spaces over $S$. If $f$ is flat, of finite presentation, and proper, then
$\Picardstack_{X/B}$ is an algebraic stack.
\end{proposition}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-picard-stack-open-in-coh},
Algebraic Stacks, Lemma
\ref{algebraic-lemma-representable-morphism-to-algebraic}
and either
Theorem \ref{theorem-coherent-algebraic}
or
Theorem \ref{theorem-coherent-algebraic-general}
\end{proof}








\section{The Picard functor}
\label{section-picard-functor}

\noindent
In this section we revisit the Picard functor discussed in
Picard Schemes of Curves, Section \ref{pic-section-picard-functor}.
The discussion will be more general as we want to study
the Picard functor of a morphism of algebraic spaces as in
the section on the Picard stack, see Section \ref{section-picard-stack}.

\medskip\noindent
Let $S$ be a scheme and let $X$ be an algebraic space over $S$.
An invertible sheaf on $X$ is an invertible $\mathcal{O}_X$-module
on $X_\etale$, see
Modules on Sites, Definition \ref{sites-modules-definition-invertible-sheaf}.
The group of isomorphism classes of invertible modules is denoted
$\Pic(X)$, see
Modules on Sites, Definition \ref{sites-modules-definition-pic}.
Given a morphism $f : X \to Y$ of algebraic spaces over $S$
pullback defines a group homomorphism $\Pic(Y) \to \Pic(X)$.
The assignment
$X \leadsto \Pic(X)$ is a contravariant functor from the category
of schemes to the category of abelian groups. This functor is not
representable, but it turns out that a relative variant of this
construction sometimes is representable.

\begin{situation}
\label{situation-pic}
Let $S$ be a scheme.
Let $f : X \to B$ be a morphism of algebraic spaces over $S$.
We define
$$
\Picardfunctor_{X/B} : (\Sch/B)^{opp} \longrightarrow \textit{Sets}
$$
as the fppf sheafification of the functor which to a scheme $T$
over $B$ associates the group $\Pic(X_T)$.
\end{situation}

\noindent
In Situation \ref{situation-pic} we sometimes think of
$\Picardfunctor_{X/B}$ as a functor $(\Sch/S)^{opp} \to \textit{Sets}$
endowed with a morphism $\Picardfunctor_{X/B} \to B$. In this point
of view, we define $\Picardfunctor_{X/B}$ to be the fppf sheafification of
the functor
$$
T/S \longmapsto \{(h, \mathcal{L}) \mid
h : T \to B,\ \mathcal{L} \in \Pic(X \times_{B, h} T)\}
$$
In particular, when we say that $\Picardfunctor_{X/B}$ is an algebraic space,
we mean that the corresponding functor
$(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\medskip\noindent
An often used remark is that if $T$ is a scheme over $B$, then
$\Picardfunctor_{X_T/T}$ is the restriction of $\Picardfunctor_{X/B}$ to
$(\Sch/T)_{fppf}$.

\begin{lemma}
\label{lemma-pic-over-pic}
In Situation \ref{situation-pic}
the functor $\Picardfunctor_{X/B}$ is the sheafification of
the functor $T \mapsto \Ob(\Picardstack_{X/B, T})/\cong$.
\end{lemma}

\begin{proof}
Since the fibre category $\Picardstack_{X/B, T}$ of the Picard stack
$\Picardstack_{X/B}$ over $T$ is the category of invertible sheaves on
$X_T$ (see Section \ref{section-picard-stack} and
Examples of Stacks, Section \ref{examples-stacks-section-picard-stack})
this is immediate from the definitions.
\end{proof}

\noindent
It turns out to be nontrivial to see what the value of $\Picardfunctor_{X/B}$
is on schemes $T$ over $B$. Here is a lemma that helps with this task.

\begin{lemma}
\label{lemma-flat-geometrically-connected-fibres}
In Situation \ref{situation-pic}.
If $\mathcal{O}_T \to f_{T, *}\mathcal{O}_{X_T}$ is an isomorphism
for all schemes $T$ over $B$, then
$$
0 \to \Pic(T) \to \Pic(X_T) \to \Picardfunctor_{X/B}(T)
$$
is an exact sequence for all $T$.
\end{lemma}

\begin{proof}
We may replace $B$ by $T$ and $X$ by $X_T$ and assume that $B = T$
to simplify the notation. Let $\mathcal{N}$ be an invertible
$\mathcal{O}_B$-module. If $f^*\mathcal{N} \cong \mathcal{O}_X$, then
we see that $f_*f^*\mathcal{N} \cong f_*\mathcal{O}_X \cong \mathcal{O}_B$
by assumption. Since $\mathcal{N}$ is locally trivial, we see that
the canonical map $\mathcal{N} \to f_*f^*\mathcal{N}$ is locally
an isomorphism (because $\mathcal{O}_B \to f_*f^*\mathcal{O}_B$
is an isomorphism by assumption). Hence we conclude that
$\mathcal{N} \to f_*f^*\mathcal{N} \to \mathcal{O}_B$ is an isomorphism
and we see that $\mathcal{N}$ is trivial. This proves the first arrow
is injective.

\medskip\noindent
Let $\mathcal{L}$ be an invertible $\mathcal{O}_X$-module which is in
the kernel of $\Pic(X) \to \Picardfunctor_{X/B}(B)$. Then there exists
an fppf covering $\{B_i \to B\}$ such that $\mathcal{L}$ pulls back
to the trivial invertible sheaf on $X_{B_i}$. Choose a trivializing
section $s_i$. Then $\text{pr}_0^*s_i$ and $\text{pr}_1^*s_j$ are both
trivialising sections of $\mathcal{L}$ over $X_{B_i \times_B B_j}$
and hence differ by a multiplicative unit
$$
f_{ij} \in
\Gamma(X_{S_i \times_B B_j}, \mathcal{O}_{X_{B_i \times_B B_j}}^*) =
\Gamma(B_i \times_B B_j, \mathcal{O}_{B_i \times_N B_j}^*)
$$
(equality by our assumption on pushforward of structure sheaves).
Of course these elements satisfy the cocycle condition on
$B_i \times_B B_j \times_B B_k$, hence they define a descent datum
on invertible sheaves for the fppf covering $\{B_i \to B\}$.
By Descent, Proposition \ref{descent-proposition-fpqc-descent-quasi-coherent}
there is an invertible $\mathcal{O}_B$-module $\mathcal{N}$
with trivializations over $B_i$ whose associated descent datum is
$\{f_{ij}\}$. (The proposition applies because $B$ is a scheme
by the replacement performed at the start of the proof.)
Then $f^*\mathcal{N} \cong \mathcal{L}$ as the
functor from descent data to modules is fully faithful.
\end{proof}

\begin{lemma}
\label{lemma-flat-geometrically-connected-fibres-with-section}
In Situation \ref{situation-pic} let $\sigma : B \to X$ be a section.
Assume that $\mathcal{O}_T \to f_{T, *}\mathcal{O}_{X_T}$ is an isomorphism
for all $T$ over $B$. Then
$$
0 \to \Pic(T) \to \Pic(X_T) \to \Picardfunctor_{X/B}(T) \to 0
$$
is a split exact sequence with splitting given by
$\sigma_T^* : \Pic(X_T) \to \Pic(T)$.
\end{lemma}

\begin{proof}
Denote $K(T) = \Ker(\sigma_T^* : \Pic(X_T) \to \Pic(T))$.
Since $\sigma$ is a section of $f$ we see that $\Pic(X_T)$ is the direct
sum of $\Pic(T)$ and $K(T)$.
Thus by Lemma \ref{lemma-flat-geometrically-connected-fibres} we see that
$K(T) \subset \Picardfunctor_{X/B}(T)$ for all $T$. Moreover, it is clear
from the construction that $\Picardfunctor_{X/B}$ is the sheafification
of the presheaf $K$. To finish the proof it suffices to show that
$K$ satisfies the sheaf condition for fppf coverings which we do
in the next paragraph.

\medskip\noindent
Let $\{T_i \to T\}$ be an fppf covering. Let $\mathcal{L}_i$ be
elements of $K(T_i)$ which map to the same elements of $K(T_i \times_T T_j)$
for all $i$ and $j$. Choose an isomorphism
$\alpha_i : \mathcal{O}_{T_i} \to \sigma_{T_i}^*\mathcal{L}_i$
for all $i$. Choose an isomorphism
$$
\varphi_{ij} :
\mathcal{L}_i|_{X_{T_i \times_T T_j}}
\longrightarrow
\mathcal{L}_j|_{X_{T_i \times_T T_j}}
$$
If the map
$$
\alpha_j|_{T_i \times_T T_j} \circ
\sigma_{T_i \times_T T_j}^*\varphi_{ij} \circ
\alpha_i|_{T_i \times_T T_j} :
\mathcal{O}_{T_i \times_T T_j} \to \mathcal{O}_{T_i \times_T T_j}
$$
is not equal to multiplication by $1$ but some $u_{ij}$, then we can scale
$\varphi_{ij}$ by $u_{ij}^{-1}$ to correct this. Having done this, consider
the self map
$$
\varphi_{ki}|_{X_{T_i \times_T T_j \times_T T_k}} \circ
\varphi_{jk}|_{X_{T_i \times_T T_j \times_T T_k}} \circ
\varphi_{ij}|_{X_{T_i \times_T T_j \times_T T_k}}
\quad\text{on}\quad
\mathcal{L}_i|_{X_{T_i \times_T T_j \times_T T_k}}
$$
which is given by multiplication by some section $f_{ijk}$
of the structure sheaf of $X_{T_i \times_T T_j \times_T T_k}$.
By our choice of $\varphi_{ij}$ we see that the pullback of
this map by $\sigma$ is equal to multiplication by $1$. By
our assumption on functions on $X$, we see that $f_{ijk} = 1$.
Thus we obtain a descent datum for the fppf covering
$\{X_{T_i} \to X\}$. By
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
there is an invertible $\mathcal{O}_{X_T}$-module $\mathcal{L}$
and an isomorphism $\alpha : \mathcal{O}_T \to \sigma_T^*\mathcal{L}$
whose pullback to $X_{T_i}$ recovers $(\mathcal{L}_i, \alpha_i)$
(small detail omitted). Thus $\mathcal{L}$ defines an object
of $K(T)$ as desired.
\end{proof}

\noindent
In Situation \ref{situation-pic} let $\sigma : B \to X$ be a section.
We denote $\Picardstack_{X/B, \sigma}$ the category defined as follows:
\begin{enumerate}
\item An object is a quadruple $(T, h, \mathcal{L}, \alpha)$, where
$(T, h, \mathcal{L})$ is an object of $\Picardstack_{X/B}$ over $T$ and
$\alpha : \mathcal{O}_T \to \sigma_T^*\mathcal{L}$
is an isomorphism.
\item A morphism $(g, \varphi) : (T, h, \mathcal{L}, \alpha)
\to (T', h', \mathcal{L}', \alpha')$
is given by a morphism of schemes $g : T \to T'$ with $h = h' \circ g$
and an isomorphism $\varphi : (g')^*\mathcal{L}' \to \mathcal{L}$
such that $\sigma_T^*\varphi \circ g^*\alpha' = \alpha$.
Here $g' : X_{T'} \to X_T$ is the base change of $g$.
\end{enumerate}
There is a natural faithful forgetful functor
$$
\Picardstack_{X/B, \sigma} \longrightarrow
\Picardstack_{X/B}
$$
In this way we view $\Picardstack_{X/B, \sigma}$ as a category
over $(\Sch/S)_{fppf}$.

\begin{lemma}
\label{lemma-pic-with-section-stack}
In Situation \ref{situation-pic} let $\sigma : B \to X$ be a section.
Then $\Picardstack_{X/B, \sigma}$ as defined above is a stack in
groupoids over $(\Sch/S)_{fppf}$.
\end{lemma}

\begin{proof}
We already know that $\Picardstack_{X/B}$ is a stack in groupoids
over $(\Sch/S)_{fppf}$ by
Examples of Stacks, Lemma \ref{examples-stacks-lemma-picard-stack}.
Let us show descent for objects for $\Picardstack_{X/B, \sigma}$.
Let $\{T_i \to T\}$ be an fppf covering and let
$\xi_i = (T_i, h_i, \mathcal{L}_i, \alpha_i)$ be an object of
$\Picardstack_{X/B, \sigma}$ lying over $T_i$, and let
$\varphi_{ij} : \text{pr}_0^*\xi_i \to \text{pr}_1^*\xi_j$
be a descent datum. Applying the result for $\Picardstack_{X/B}$
we see that we may assume we have an object $(T, h, \mathcal{L})$
of $\Picardstack_{X/B}$ over $T$ which pulls back to $\xi_i$ for all $i$.
Then we get
$$
\alpha_i : \mathcal{O}_{T_i} \to \sigma_{T_i}^*\mathcal{L}_i =
(T_i \to T)^*\sigma_T^*\mathcal{L}
$$
Since the maps $\varphi_{ij}$ are compatible with the $\alpha_i$
we see that $\alpha_i$ and $\alpha_j$ pullback to the same map
on $T_i \times_T T_j$. By descent of quasi-coherent sheaves
(Descent, Proposition \ref{descent-proposition-fpqc-descent-quasi-coherent},
we see that the $\alpha_i$ are the restriction of a single map
$\alpha : \mathcal{O}_T \to \sigma_T^*\mathcal{L}$ as desired.
We omit the proof of descent for morphisms.
\end{proof}

\begin{lemma}
\label{lemma-compare-pic-with-section}
In Situation \ref{situation-pic} let $\sigma : B \to X$ be a section.
The morphism $\Picardstack_{X/B, \sigma} \to \Picardstack_{X/B}$
is representable, surjective, and smooth.
\end{lemma}

\begin{proof}
Let $T$ be a scheme and let $(\Sch/T)_{fppf} \to \Picardstack_{X/B}$
be given by the object $\xi = (T, h, \mathcal{L})$ of $\Picardstack_{X/B}$
over $T$. We have to show that
$$
(\Sch/T)_{fppf} \times_{\xi, \Picardstack_{X/B}} \Picardstack_{X/B, \sigma}
$$
is representable by a scheme $V$ and that the corresponding morphism
$V \to T$ is surjective and smooth. See
Algebraic Stacks, Sections \ref{algebraic-section-representable-morphism},
\ref{algebraic-section-morphisms-representable-by-algebraic-spaces}, and
\ref{algebraic-section-representable-properties}.
The forgetful functor $\Picardstack_{X/B, \sigma} \to \Picardstack_{X/B}$
is faithful on fibre categories and for $T'/T$ the set of isomorphism
classes is the set of isomorphisms
$$
\alpha' : \mathcal{O}_{T'} \longrightarrow (T' \to T)^*\sigma_T^*\mathcal{L}
$$
See Algebraic Stacks, Lemma
\ref{algebraic-lemma-criterion-map-representable-spaces-fibred-in-groupoids}.
We know this functor is representable by an affine scheme $U$ of finite
presentation over $T$ by Proposition \ref{proposition-isom}
(applied to $\text{id} : T \to T$ and $\mathcal{O}_T$ and
$\sigma^*\mathcal{L}$). Working Zariski locally on $T$ we may
assume that $\sigma_T^*\mathcal{L}$ is isomorphic to $\mathcal{O}_T$
and then we see that our functor is representable by
$\mathbf{G}_m \times T$ over $T$. Hence
$U \to T$ Zariski locally on $T$ looks like 
the projection $\mathbf{G}_m \times T \to T$ which
is indeed smooth and surjective.
\end{proof}

\begin{lemma}
\label{lemma-flat-geometrically-connected-fibres-with-section-functor-stack}
In Situation \ref{situation-pic} let $\sigma : B \to X$ be a section.
If $\mathcal{O}_T \to f_{T, *}\mathcal{O}_{X_T}$ is an isomorphism
for all $T$ over $B$, then
$\Picardstack_{X/B, \sigma} \to (\Sch/S)_{fppf}$
is fibred in setoids with set of isomorphism classes over $T$ given by
$$
\coprod\nolimits_{h : T \to B}
\Ker(\sigma_T^* : \Pic(X \times_{B, h} T) \to \Pic(T))
$$
\end{lemma}

\begin{proof}
If $\xi = (T, h, \mathcal{L}, \alpha)$
is an object of $\Picardstack_{X/B, \sigma}$
over $T$, then an automorphism $\varphi$ of
$\xi$ is given by multiplication with an invertible global section $u$
of the structure sheaf of $X_T$ such that moreover $\sigma_T^*u = 1$.
Then $u = 1$ by our assumption that
$\mathcal{O}_T \to f_{T, *}\mathcal{O}_{X_T}$ is an isomorphism.
Hence $\Picardstack_{X/B, \sigma}$
is fibred in setoids over $(\Sch/S)_{fppf}$.
Given $T$ and $h : T \to B$
the set of isomorphism classes of pairs $(\mathcal{L}, \alpha)$
is the same as the set of isomorphism classes of $\mathcal{L}$
with $\sigma_T^*\mathcal{L} \cong \mathcal{O}_T$ (isomorphism
not specified). This is clear because any two choices
of $\alpha$ differ by a global unit on $T$ and this is the
same thing as a global unit on $X_T$.
\end{proof}

\begin{proposition}
\label{proposition-pic-functor}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic
spaces over $S$. Assume that
\begin{enumerate}
\item $f$ is flat, of finite presentation, and proper, and
\item $\mathcal{O}_T \to f_{T, *}\mathcal{O}_{X_T}$ is an isomorphism
for all schemes $T$ over $B$.
\end{enumerate}
Then $\Picardfunctor_{X/B}$ is an algebraic space.
\end{proposition}

\noindent
In the situation of the proposition the algebraic stack
$\Picardstack_{X/B}$ is a gerbe over the algebraic space
$\Picardfunctor_{X/B}$. After developing the general
theory of gerbes, this provides a shorter proof of
the proposition (but using more general theory).

\begin{proof}
There exists a surjective, flat, finitely presented morphism
$B' \to B$ of algebraic spaces such that the base change $X' = X \times_B B'$
over $B'$ has a section: namely, we can take $B' = X$.
Observe that $\Picardfunctor_{X'/B'} = B' \times_B \Picardfunctor_{X/B}$.
Hence $\Picardfunctor_{X'/B'} \to \Picardfunctor_{X/B}$ is representable
by algebraic spaces, surjective, flat, and finitely presented.
Hence, if we can show that $\Picardfunctor_{X'/B'}$ is an algebraic space,
then it follows that $\Picardfunctor_{X/B}$
is an algebraic space by Bootstrap, Theorem
\ref{bootstrap-theorem-final-bootstrap}.
In this way we reduce to the case described in the next paragraph.

\medskip\noindent
In addition to the assumptions of the proposition, assume that
we have a section $\sigma : B \to X$. By
Proposition \ref{proposition-pic} we see that
$\Picardstack_{X/B}$ is an algebraic stack.
By Lemma \ref{lemma-compare-pic-with-section} and
Algebraic Stacks, Lemma
\ref{algebraic-lemma-representable-morphism-to-algebraic}
we see that $\Picardstack_{X/B, \sigma}$ is an algebraic stack.
By Lemma
\ref{lemma-flat-geometrically-connected-fibres-with-section-functor-stack}
and Algebraic Stacks, Lemma
\ref{algebraic-lemma-characterize-representable-by-space}
we see that $T \mapsto \Ker(\sigma_T^* : \Pic(X_T) \to \Pic(T))$
is an algebraic space.
By Lemma \ref{lemma-flat-geometrically-connected-fibres-with-section}
this functor is the same as $\Picardfunctor_{X/B}$.
\end{proof}

\begin{lemma}
\label{lemma-diagonal-pic}
With assumptions and notation as in Proposition \ref{proposition-pic-functor}.
Then the diagonal
$\Picardfunctor_{X/B} \to \Picardfunctor_{X/B} \times_B \Picardfunctor_{X/B}$
is representable by immersions. In other words, $\Picardfunctor_{X/B} \to B$
is locally separated.
\end{lemma}

\begin{proof}
Let $T$ be a scheme over $B$ and let $s, t \in \Picardfunctor_{X/B}(T)$.
We want to show that there exists a locally closed subscheme $Z \subset T$
such that $s|_Z = t|_Z$ and such that a morphism $T' \to T$ factors
through $Z$ if and only if $s|_{T'} = t|_{T'}$.

\medskip\noindent
We first reduce the general problem to the case where $s$ and $t$ come
from invertible modules on $X_T$. We suggest the reader skip this step.
Choose an fppf covering $\{T_i \to T\}_{i \in I}$ such that
$s|_{T_i}$ and $t|_{T_i}$ come from $\Pic(X_{T_i})$ for all $i$.
Suppose that we can show the result for all the pairs
$s|_{T_i}, t|_{T_i}$. Then we obtain locally closed subschemes
$Z_i \subset T_i$ with the desired universal property.
It follows that $Z_i$ and $Z_j$ have the same scheme theoretic
inverse image in $T_i \times_T T_j$.
This determines a descend datum on $Z_i/T_i$.
Since $Z_i \to T_i$ is locally quasi-finite, it follows from
More on Morphisms, Lemma
\ref{more-morphisms-lemma-separated-locally-quasi-finite-morphisms-fppf-descend}
that we obtain a locally quasi-finite morphism $Z \to T$
recovering $Z_i \to T_i$ by base change. Then $Z \to T$ is an immersion
by Descent, Lemma \ref{descent-lemma-descending-fppf-property-immersion}.
Finally, because $\Picardfunctor_{X/B}$ is an fppf sheaf, we conclude
that $s|_Z = t|_Z$ and that $Z$ satisfies the universal property
mentioned above.

\medskip\noindent
Assume $s$ and $t$ come from invertible modules $\mathcal{V}$, $\mathcal{W}$
on $X_T$.
Set $\mathcal{L} = \mathcal{V} \otimes \mathcal{W}^{\otimes -1}$
We are looking for a locally closed subscheme $Z$ of $T$
such that $T' \to T$ factors through $Z$ if and only if $\mathcal{L}_{X_{T'}}$
is the pullback of an invertible sheaf on $T'$, see
Lemma \ref{lemma-flat-geometrically-connected-fibres}.
Hence the existence of $Z$ follows from
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-diagonal-picard-flat-proper}.
\end{proof}











\section{Relative morphisms}
\label{section-relative-morphisms}

\noindent
We continue the discussion from Criteria for Representability, Section
\ref{criteria-section-relative-morphisms}.
In that section, starting with a scheme $S$ and morphisms
of algebraic spaces $Z \to B$ and $X \to B$ over $S$
we constructed a functor
$$
\mathit{Mor}_B(Z, X) : (\Sch/B)^{opp} \longrightarrow \textit{Sets}, \quad
T \longmapsto \{f : Z_T \to X_T\}
$$
We sometimes think of $\mathit{Mor}_B(Z, X)$
as a functor $(\Sch/S)^{opp} \to \textit{Sets}$ endowed with a morphism
$\mathit{Mor}_B(Z, X) \to B$.
Namely, if $T$ is a scheme over $S$, then an element
of $\mathit{Mor}_B(Z, X)(T)$ is a pair $(f, h)$
where $h$ is a morphism $h : T \to B$
and $f : Z \times_{B, h} T \to X \times_{B, h} T$
is a morphism of algebraic spaces over $T$. In particular, when we say
that $\mathit{Mor}_B(Z, X)$ is an algebraic space, we mean that the
corresponding functor $(\Sch/S)^{opp} \to \textit{Sets}$ is an algebraic space.

\begin{lemma}
\label{lemma-Mor-into-Hilb}
Let $S$ be a scheme. Consider morphisms
of algebraic spaces $Z \to B$ and $X \to B$ over $S$.
If $X \to B$ is separated and $Z \to B$ is
of finite presentation, flat, and proper,
then there is a natural
injective transformation of functors
$$
\mathit{Mor}_B(Z, X) \longrightarrow \Hilbfunctor_{Z \times_B X/B}
$$
which maps a morphism $f : Z_T \to X_T$ to its graph.
\end{lemma}

\begin{proof}
Given a scheme $T$ over $B$ and a morphism $f_T : Z_T \to X_T$
over $T$, the graph of $f$ is the morphism
$\Gamma_f = (\text{id}, f) : Z_T \to Z_T \times_T X_T = (Z \times_B X)_T$.
Recall that being separated, flat, proper, or finite presentation
are properties of morphisms of algebraic spaces which are stable
under base change (Morphisms of Spaces, Lemmas
\ref{spaces-morphisms-lemma-base-change-separated},
\ref{spaces-morphisms-lemma-base-change-flat},
\ref{spaces-morphisms-lemma-base-change-proper}, and
\ref{spaces-morphisms-lemma-base-change-finite-presentation}).
Hence $\Gamma_f$ is a closed immersion by
Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-semi-diagonal}.
Moreover, $\Gamma_f(Z_T)$ is flat, proper, and of finite presentation over $T$.
Thus $\Gamma_f(Z_T)$ defines an element of $\Hilbfunctor_{Z \times_B X/B}(T)$.
To show the transformation is injective it suffices to show that
two morphisms with the same graph are the same. This is true because
if $Y \subset (Z \times_B X)_T$ is the graph of a morphism $f$, then
we can recover $f$ by using the inverse of $\text{pr}_1|_Y : Y \to Z_T$
composed with $\text{pr}_2|_Y$.
\end{proof}

\begin{lemma}
\label{lemma-Mor-into-Hilb-open}
Assumption and notation as in Lemma \ref{lemma-Mor-into-Hilb}.
The transformation
$\mathit{Mor}_B(Z, X) \longrightarrow \Hilbfunctor_{Z \times_B X/B}$
is representable by open immersions.
\end{lemma}

\begin{proof}
Let $T$ be a scheme over $B$ and let $Y \subset (Z \times_B X)_T$
be an element of $\Hilbfunctor_{Z \times_B X/B}(T)$. Then we see that
$Y$ is the graph of a morphism $Z_T \to X_T$ over $T$ if and only
if $k = \text{pr}_1|_Y : Y \to Z_T$ is an isomorphism. By
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-where-isomorphism}
there exists an open subscheme $V \subset T$ such that
for any morphism of schemes $T' \to T$ we have
$k_{T'} : Y_{T'} \to Z_{T'}$ is an isomorphism if and
only if $T' \to T$ factors through $V$.
This proves the lemma.
\end{proof}

\begin{proposition}
\label{proposition-Mor}
Let $S$ be a scheme. Let $Z \to B$ and $X \to B$ be morphisms of algebraic
spaces over $S$. Assume $X \to B$ is of finite presentation and separated and
$Z \to B$ is of finite presentation, flat, and proper. Then
$\mathit{Mor}_B(Z, X)$ is an algebraic space locally of finite
presentation over $B$.
\end{proposition}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-Mor-into-Hilb-open}
and Proposition \ref{proposition-hilb}.
\end{proof}








\section{The stack of algebraic spaces}
\label{section-stack-of-spaces}

\noindent
This section continuous the discussion started in
Examples of Stacks, Sections
\ref{examples-stacks-section-stack-of-spaces},
\ref{examples-stacks-section-stack-of-finite-type-spaces}, and
\ref{examples-stacks-section-stack-in-groupoids-of-finite-type-spaces}.
Working over $\mathbf{Z}$, the discussion therein shows
that we have a stack in groupoids
$$
p'_{ft} : \Spacesstack'_{ft} \longrightarrow \Sch_{fppf}
$$
parametrizing (nonflat) families of finite type algebraic spaces.
More precisely, an object\footnote{We always perform a replacement as in
Examples of Stacks, Lemma \ref{examples-stacks-lemma-stack-ft-spaces}.}
of $\Spacesstack'_{ft}$ is a finite type morphism $X \to S$
from an algebraic space $X$ to a scheme $S$ and a morphism
$(X' \to S') \to (X \to S)$ is given by a pair $(f, g)$
where $f : X' \to X$ is a morphism of algebraic spaces
and $g : S' \to S$ is a morphism of schemes
which fit into a commutative diagram
$$
\xymatrix{
X' \ar[d] \ar[r]_f & X \ar[d] \\
S' \ar[r]^g & S
}
$$
inducing an isomorphism $X' \to S' \times_S X$, in other words, the
diagram is cartesian in the category of algebraic spaces.
The functor $p'_{ft}$ sends $(X \to S)$ to $S$ and sends
$(f, g)$ to $g$. We define a full subcategory
$$
\Spacesstack'_{fp, flat, proper} \subset
\Spacesstack'_{ft}
$$
consisting of objects $X \to S$ of $\Spacesstack'_{ft}$
such that $X \to S$ is of finite presentation, flat, and proper.
We denote
$$
p'_{fp, flat, proper} :
\Spacesstack'_{fp, flat, proper}
\longrightarrow
\Sch_{fppf}
$$
the restriction of the functor $p'_{ft}$ to the indicated subcategory.
We first review the results already obtained in the references
listed above, and then we start adding further results.

\begin{lemma}
\label{lemma-spaces-fibred-in-groupoids}
The category $\Spacesstack'_{ft}$ is fibred in groupoids
over $\Sch_{fppf}$. The same is true for
$\Spacesstack'_{fp, flat, proper}$.
\end{lemma}

\begin{proof}
We have seen this in
Examples of Stacks, Section
\ref{examples-stacks-section-stack-in-groupoids-of-finite-type-spaces}
for the case of $\Spacesstack'_{ft}$ and this easily implies the
result for the other case. However, let us also prove
this directly by checking conditions (1) and (2) of
Categories, Definition \ref{categories-definition-fibred-groupoids}.

\medskip\noindent
Condition (1). Let $X \to S$ be an object of $\Spacesstack'_{ft}$
and let $S' \to S$ be a morphism of schemes. Then we set
$X' = S' \times_S X$. Note that $X' \to S'$ is of finite type
by Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-base-change-finite-type}.
to obtain a morphism $(X' \to S') \to (X \to S)$
lying over $S' \to S$.
Argue similarly for the other case using
Morphisms of Spaces, Lemmas
\ref{spaces-morphisms-lemma-base-change-finite-presentation},
\ref{spaces-morphisms-lemma-base-change-flat}, and
\ref{spaces-morphisms-lemma-base-change-proper}.

\medskip\noindent
Condition (2). Consider morphisms
$(f, g) : (X' \to S') \to (X \to S)$ and $(a, b) : (Y \to T) \to (X \to S)$
of $\Spacesstack'_{ft}$. Given a morphism $h : T \to S'$ with
$g \circ h = b$ we have to show
there is a unique morphism $(k, h) : (Y \to T) \to (X' \to S')$ of
$\Spacesstack'_{ft}$ such that
$(f, g) \circ (k, h) = (a, b)$.
This is clear from the fact that $X' = S' \times_S X$.
The same therefore works for any full subcategory of
$\Spacesstack'_{ft}$ satisfying (1).
\end{proof}

\begin{lemma}
\label{lemma-spaces-diagonal}
The diagonal
$$
\Delta : \Spacesstack'_{fp, flat, proper} \longrightarrow
\Spacesstack'_{fp, flat, proper} \times \Spacesstack'_{fp, flat, proper}
$$
is representable by algebraic spaces.
\end{lemma}

\begin{proof}
We will use criterion (2) of
Algebraic Stacks, Lemma \ref{algebraic-lemma-representable-diagonal}.
Let $S$ be a scheme and let $X$ and $Y$ be algebraic spaces
of finite presentation over $S$, flat over $S$, and proper over $S$.
We have to show that the functor
$$
\mathit{Isom}_S(X, Y) : (\Sch/S)_{fppf} \longrightarrow \textit{Sets}, \quad
T \longmapsto \{f : X_T \to Y_T \text{ isomorphism}\}
$$
is an algebraic space. An elementary argument shows that
$\mathit{Isom}_S(X, Y)$ sits in a fibre product
$$
\xymatrix{
\mathit{Isom}_S(X, Y) \ar[r] \ar[d] & S \ar[d]_{(\text{id}, \text{id})} \\
\mathit{Mor}_S(X, Y) \times \mathit{Mor}_S(Y, X) \ar[r] &
\mathit{Mor}_S(X, X) \times \mathit{Mor}_S(Y, Y)
}
$$
The bottom arrow sends $(\varphi, \psi)$ to
$(\psi \circ \varphi, \varphi \circ \psi)$.
By Proposition \ref{proposition-Mor} the functors on the bottom row
are algebraic spaces over $S$. 
Hence the result follows from the fact that the category of
algebraic spaces over $S$ has fibre products.
\end{proof}

\begin{lemma}
\label{lemma-spaces-stack}
The category $\Spacesstack'_{ft}$ is a stack in groupoids
over $\Sch_{fppf}$. The same is true for
$\Spacesstack'_{fp, flat, proper}$.
\end{lemma}

\begin{proof}
The reason this lemma holds is the slogan: any fppf descent datum for algebraic
spaces is effective, see Bootstrap, Section
\ref{bootstrap-section-applications}.
More precisely, the lemma for $\Spacesstack'_{ft}$ follows from
Examples of Stacks, Lemma
\ref{examples-stacks-lemma-stack-of-finite-type-spaces}
as we saw in Examples of Stacks, Section
\ref{examples-stacks-section-stack-in-groupoids-of-finite-type-spaces}.
However, let us review the proof. We need to check conditions
(1), (2), and (3) of Stacks, Definition
\ref{stacks-definition-stack-in-groupoids}.

\medskip\noindent
Property (1) we have seen in Lemma \ref{lemma-spaces-fibred-in-groupoids}.

\medskip\noindent
Property (2) follows from
Lemma \ref{lemma-spaces-diagonal} in the case of
$\Spacesstack'_{fp, flat, proper}$.
In the case of $\Spacesstack'_{ft}$ it follows
from Examples of Stacks, Lemma
\ref{examples-stacks-lemma-pre-stack-of-spaces}
(and this is really the ``correct'' reference).

\medskip\noindent
Condition (3) for $\Spacesstack'_{ft}$ is checked as follows. Suppose given
\begin{enumerate}
\item an fppf covering $\{U_i \to U\}_{i \in I}$ in $\Sch_{fppf}$,
\item for each $i \in I$ an algebraic space $X_i$ of finite type over
$U_i$, and
\item for each $i, j \in I$ an isomorphism
$\varphi_{ij} : X_i \times_U U_j \to U_i \times_U X_j$ of algebraic spaces
over $U_i \times_U U_j$ satisfying the cocycle condition over
$U_i \times_U U_j \times_U U_k$.
\end{enumerate}
We have to show there exists an algebraic space $X$ of finite type over $U$
and isomorphisms $X_{U_i} \cong X_i$ over $U_i$ recovering the
isomorphisms $\varphi_{ij}$. This follows from
Bootstrap, Lemma \ref{bootstrap-lemma-descend-algebraic-space} part (2).
By Descent on Spaces, Lemma
\ref{spaces-descent-lemma-descending-property-finite-type}
we see that $X \to U$ is of finite type.
In the case of $\Spacesstack'_{fp, flat, proper}$
one additionally uses
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-descending-property-finite-presentation},
\ref{spaces-descent-lemma-descending-property-flat}, and
\ref{spaces-descent-lemma-descending-property-proper}
in the last step.
\end{proof}

\noindent
Sanity check: the stacks $\Spacesstack'_{ft}$ and
$\Spacesstack'_{fp, flat, proper}$
play the same role among algebraic spaces.

\begin{lemma}
\label{lemma-extend-spaces-to-spaces}
Let $T$ be an algebraic space over $\mathbf{Z}$. Let $\mathcal{S}_T$
denote the corresponding algebraic stack (Algebraic Stacks, Sections
\ref{algebraic-section-split},
\ref{algebraic-section-representable-by-algebraic-spaces}, and
\ref{algebraic-section-stacks-spaces}).
We have an equivalence of categories
$$
\left\{
\begin{matrix}
\text{morphisms of algebraic spaces }\\
X \to T\text{ of finite type}
\end{matrix}
\right\}
\longrightarrow
\Mor_{\textit{Cat}/\Sch_{fppf}}(\mathcal{S}_T, \Spacesstack'_{ft})
$$
and an equivalence of categories
$$
\left\{
\begin{matrix}
\text{morphisms of algebraic spaces }X \to T\\
\text{of finite presentation, flat, and proper}
\end{matrix}
\right\}
\longrightarrow
\Mor_{\textit{Cat}/\Sch_{fppf}}(\mathcal{S}_T,
\Spacesstack'_{fp, flat, proper})
$$
\end{lemma}

\begin{proof}
We are going to deduce this lemma from the fact that it holds for schemes
(essentially by construction of the stacks) and the fact that fppf descent
data for algebraic spaces over algerbaic spaces are effective.
We strongly encourage the reader to skip the proof.

\medskip\noindent
The construction from left to right in either arrow is straightforward:
given $X \to T$ of finite type the functor
$\mathcal{S}_T \to  \Spacesstack'_{ft}$ assigns to $U/T$ the
base change $X_U \to U$. We will explain how to construct a quasi-inverse.

\medskip\noindent
If $T$ is a scheme, then there is a quasi-inverse by the $2$-Yoneda lemma, see
Categories, Lemma \ref{categories-lemma-yoneda-2category}.
Let $p : U \to T$ be a surjective \'etale morphism where $U$ is a scheme.
Let $R = U \times_T U$ with projections $s, t : R \to U$.
Observe that we obtain morphisms
$$
\xymatrix{
\mathcal{S}_{U \times_T U \times_T U} \ar@<2ex>[r] \ar[r] \ar@<-2ex>[r] &
\mathcal{S}_R \ar@<1ex>[r] \ar@<-1ex>[r] &
\mathcal{S}_U \ar[r] &
\mathcal{S}_T
}
$$
satisfying various compatibilities (on the nose).

\medskip\noindent
Let $G : \mathcal{S}_T \to \Spacesstack'_{ft}$ be a functor over $\Sch_{fppf}$.
The restriction of $G$ to $\mathcal{S}_U$ via the map displayed above
corresponds to a finite type morphism $X_U \to U$ of algebraic spaces
via the $2$-Yoneda lemma. Since $p \circ s = p \circ t$ we see that
$R \times_{s, U} X_U$ and $R \times_{t, U} X_U$ both correspond to the
restriction of $G$ to $\mathcal{S}_R$. Thus we obtain a canonical isomorphism
$\varphi : X_U \times_{U, t} R \to R \times_{s, U} X_U$ over $R$.
This isomorphism satisfies the cocycle condition by the
various compatibilities of the diagram given above.
Thus a descent datum which is effective by Bootstrap, Lemma
\ref{bootstrap-lemma-descend-algebraic-space} part (2).
In other words, we obtain an object $X \to T$ of the right hand side
category. We omit checking the construction $G \leadsto X$
is functorial and that it is quasi-inverse to the other construction.
In the case of $\Spacesstack'_{fp, flat, proper}$ one additionally uses
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-descending-property-finite-presentation},
\ref{spaces-descent-lemma-descending-property-flat}, and
\ref{spaces-descent-lemma-descending-property-proper}
in the last step to see that $X \to T$ is of finite presentation,
flat, and proper.
\end{proof}

\begin{remark}
\label{remark-spaces-base-change}
Let $B$ be an algebraic space over $\Spec(\mathbf{Z})$.
Let $B\textit{-Spaces}'_{ft}$ be the category consisting
of pairs $(X \to S, h : S \to B)$
where $X \to S$ is an object of
$\Spacesstack'_{ft}$ and $h : S \to B$ is a morphism.
A morphism $(X' \to S', h') \to (X \to S, h)$
in $B\textit{-Spaces}'_{ft}$ is a morphism $(f, g)$
in $\Spacesstack'_{ft}$ such that $h \circ g = h'$.
In this situation the diagram
$$
\xymatrix{
B\textit{-Spaces}'_{ft} \ar[r] \ar[d] & \Spacesstack'_{ft} \ar[d] \\
(\Sch/B)_{fppf} \ar[r] & \Sch_{fppf}
}
$$
is $2$-fibre product square. This trivial remark
will occasionally be useful to deduce results from
the absolute case $\Spacesstack'_{ft}$ to the case
of families over a given base algebraic space.
Of course, a similar construction works for
$B\textit{-Spaces}'_{fp, flat, proper}$
\end{remark}

\begin{lemma}
\label{lemma-spaces-limits}
The stack
$p'_{fp, flat, proper} :
\Spacesstack'_{fp, flat, proper} \to \Sch_{fppf}$ is limit preserving
(Artin's Axioms, Definition \ref{artin-definition-limit-preserving}).
\end{lemma}

\begin{proof}
Let $T = \lim T_i$ be the limits of a
directed inverse system of affine schemes.
By Limits of Spaces, Lemma
\ref{spaces-limits-lemma-descend-finite-presentation}
the category of algebraic spaces of finite presentation
over $T$ is the colimit of the categories of algebraic spaces
of finite presentation over $T_i$.
To finish the proof use that flatness and properness
descends through the limit, see
Limits of Spaces, Lemmas
\ref{spaces-limits-lemma-descend-flat} and
\ref{spaces-limits-lemma-eventually-proper}.
\end{proof}

\begin{lemma}
\label{lemma-spaces-RS-star}
Let
$$
\xymatrix{
T \ar[r] \ar[d] & T' \ar[d] \\
S \ar[r] & S'
}
$$
be a pushout in the category of schemes where
$T \to T'$ is a thickening and $T \to S$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the functor on fibre categories
$$
\begin{matrix}
\Spacesstack'_{fp, flat, proper, S'} \\
\downarrow \\
\Spacesstack'_{fp, flat, proper, S}
\times_{\Spacesstack'_{fp, flat, proper, T}}
\Spacesstack'_{fp, flat, proper, T'}
\end{matrix}
$$
is an equivalence.
\end{lemma}

\begin{proof}
The functor is an equivalence if we drop ``proper'' from the list
of conditions and replace ``of finite presentation'' by
``locally of finite presentation'', see Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-equivalence-categories-spaces-pushout-flat}.
Thus it suffices to show that given a morphism
$X' \to S'$ of an algebraic space to $S'$ which is
flat and locally of finite presentation, then
$X' \to S'$ is proper if and only if $S \times_{S'} X' \to S$
and $T' \times_{S'} X' \to T'$ are proper.
One implication follows from the fact that
properness is preserved under base change
(Morphisms of Spaces, Lemma \ref{spaces-morphisms-lemma-base-change-proper})
and the other from the fact that properness of $S \times_{S'} X' \to S$
implies properness of $X' \to S'$ by
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-thicken-property-morphisms-cartesian}.
\end{proof}

\begin{lemma}
\label{lemma-spaces-tangent-space}
Let $k$ be a field and let $x = (X \to \Spec(k))$ be an object of
$\mathcal{X} = \Spacesstack'_{fp, flat, proper}$ over $\Spec(k)$.
\begin{enumerate}
\item If $k$ is of finite type over $\mathbf{Z}$, then
the vector spaces $T\mathcal{F}_{\mathcal{X}, k, x}$ and
$\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x})$
(see Artin's Axioms, Section \ref{artin-section-tangent-spaces})
are finite dimensional, and
\item in general the vector spaces $T_x(k)$ and $\text{Inf}_x(k)$
(see Artin's Axioms, Section \ref{artin-section-inf})
are finite dimensional.
\end{enumerate}
\end{lemma}

\begin{proof}
The discussion in Artin's Axioms, Section \ref{artin-section-tangent-spaces}
only applies to fields of finite type over the base scheme $\Spec(\mathbf{Z})$.
Our stack satisfies (RS*) by Lemma \ref{lemma-spaces-RS-star}
and we may apply
Artin's Axioms, Lemma \ref{artin-lemma-properties-lift-RS-star}
to get the vector spaces $T_x(k)$ and $\text{Inf}_x(k)$
mentioned in (2). Moreover, in the finite type case these spaces agree with the
ones mentioned in (1)
by Artin's Axioms, Remark \ref{artin-remark-compare-deformation-spaces}.
With this out of the way we can start the proof.
Observe that the first order thickening
$\Spec(k) \to \Spec(k[\epsilon]) = \Spec(k[k])$
has conormal module $k$. Hence the formula in
Deformation Theory, Lemma \ref{defos-lemma-deform-spaces}
describing infinitesimal deformations of $X$ and infinitesimal
automorphisms of $X$ become
$$
T_x(k) = \Ext^1_{\mathcal{O}_X}(\NL_{X/k}, \mathcal{O}_X)
\quad\text{and}\quad
\text{Inf}_x(k) = \Ext^0_{\mathcal{O}_X}(\NL_{X/k}, \mathcal{O}_X)
$$
By More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-netherlander-fp}
and the fact that $X$ is Noetherian, we see that
$\NL_{X/k}$ has coherent cohomology sheaves zero except
in degrees $0$ and $-1$.
By Derived Categories of Spaces, Lemma \ref{spaces-perfect-lemma-ext-finite}
the displayed $\Ext$-groups are finite $k$-vector spaces
and the proof is complete.
\end{proof}

\noindent
Beware that openness of versality (as proved in the next lemma)
is a bit strange because our stack does not satisfy formal effectiveness, see
Examples, Section \ref{examples-section-proper-spaces-not-algebraic}.
Later we will apply the openness of versality to suitable substacks of
$\Spacesstack'_{fp, flat, proper}$ which do satisfy
formal effectiveness to conclude that these stacks are algebraic.

\begin{lemma}
\label{lemma-spaces-defo-thy}
The stack in groupoids $\mathcal{X} = \Spacesstack'_{fp, flat, proper}$
satisfies openness of versality over $\Spec(\mathbf{Z})$.
Similarly, after base change (Remark \ref{remark-spaces-base-change})
openness of versality holds over any Noetherian base scheme $S$.
\end{lemma}

\begin{proof}
For the ``usual'' proof of this fact, please see the discussion
in the remark following this proof. We will prove this using
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.
We have already seen that $\mathcal{X}$ has diagonal
representable by algebraic spaces, has (RS*), and is limit preserving,
see Lemmas \ref{lemma-spaces-diagonal},
\ref{lemma-spaces-RS-star}, and
\ref{lemma-spaces-limits}.
Hence we only need to see that $\mathcal{X}$ satisfies the strong
formal effectiveness formulated in
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.

\medskip\noindent
Let $(R_n)$ be an inverse system of rings such that
$R_n \to R_m$ is surjective with square zero kernel for
all $n \geq m$. Let $X_n \to \Spec(R_n)$ be a finitely presented,
flat, proper morphism where $X_n$ is an algebraic space and
let $X_{n + 1} \to X_n$ be a morphism over $\Spec(R_{n + 1})$
inducing an isomorphism $X_n = X_{n + 1} \times_{\Spec(R_{n + 1})} \Spec(R_n)$.
We have to find a flat, proper, finitely presented morphism
$X \to \Spec(\lim R_n)$ whose source is an algebraic space
such that $X_n$ is the base change of $X$ for all $n$.

\medskip\noindent
Let $I_n = \Ker(R_n \to R_1)$. We may think of
$(X_1 \subset X_n) \to (\Spec(R_1) \subset \Spec(R_n))$
as a morphism of first order thickenings. (Please read some of the material
on thickenings of algebraic spaces in More on Morphisms of Spaces, Section
\ref{spaces-more-morphisms-section-thickenings}
before continuing.) The structure sheaf of $X_n$ is an extension
$$
0 \to \mathcal{O}_{X_1} \otimes_{R_1} I_n \to
\mathcal{O}_{X_n} \to \mathcal{O}_{X_1} \to 0
$$
over $0 \to I_n \to R_n \to R_1$, see
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-deform}.
Let's consider the extension
$$
0 \to \lim \mathcal{O}_{X_1} \otimes_{R_1} I_n \to
\lim \mathcal{O}_{X_n} \to \mathcal{O}_{X_1} \to 0
$$
over $0 \to \lim I_n \to \lim R_n \to R_1 \to 0$.
The displayed sequence is exact as the $R^1\lim$ of the system
of kernels is zero by Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-Rlim-quasi-coherent}.
Observe that the map
$$
\mathcal{O}_{X_1} \otimes_{R_1} \lim I_n \longrightarrow
\lim \mathcal{O}_{X_1} \otimes_{R_1} I_n
$$
induces an isomorphism upon applying the functor $DQ_X$, see
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-pullback-and-limits}.
Hence we obtain a unique extension
$$
0 \to \mathcal{O}_{X_1} \otimes_{R_1} \lim I_n \to
\mathcal{O}' \to \mathcal{O}_{X_1} \to 0
$$
over $0 \to \lim I_n \to \lim R_n \to R_1 \to 0$
by the equivalence of categories of
Deformation Theory, Lemma
\ref{defos-lemma-thickening-over-thickening-space-quasi-coherent}.
The sheaf $\mathcal{O}'$ determines
a first order thickening of algebraic spaces $X_1 \subset X$
over $\Spec(R_1) \subset \Spec(\lim R_n)$
by More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-first-order-thickening}.
Observe that $X \to \Spec(\lim R_n)$ is flat by the already
used More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-deform}.
By More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-deform-property}
we see that $X \to \Spec(\lim R_n)$ is proper
and of finite presentation.
This finishes the proof.
\end{proof}

\begin{remark}
\label{remark-spaces-defo-thy}
Lemma \ref{lemma-spaces-defo-thy} can also be shown using either
Artin's Axioms, Lemma \ref{artin-lemma-dual-openness}
(as in the first proof of
Lemma \ref{lemma-coherent-defo-thy}), or using an obstruction theory
as in Artin's Axioms, Lemma \ref{artin-lemma-get-openness-obstruction-theory}
(as in the second proof of
Lemma \ref{lemma-coherent-defo-thy}).
In both cases one uses the deformation and obstruction theory developed in
Cotangent, Section \ref{cotangent-section-deformations-ringed-topoi}
to translate the needed properties of deformations and obstructions
into $\Ext$-groups to which
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-compute-ext}
can be applied.
The second method (using an obstruction theory and therefore
using the full cotangent complex) is perhaps the ``standard'' method used
in most references.
\end{remark}





\section{The stack of polarized proper schemes}
\label{section-polarized}

\noindent
To study the stack of polarized proper schemes it suffices to work
over $\mathbf{Z}$ as we can later pullback to any scheme or algebraic
space we want (see Remark \ref{remark-polarized-base-change}).

\begin{situation}
\label{situation-polarized}
We define a category $\Polarizedstack$ as follows. Objects are
pairs $(X \to S, \mathcal{L})$ where
\begin{enumerate}
\item $X \to S$ is a morphism of schemes which is proper, flat, and
of finite presentation, and
\item $\mathcal{L}$ is an invertible $\mathcal{O}_X$-module
which is relatively ample on $X/S$
(Morphisms, Definition \ref{morphisms-definition-relatively-ample}).
\end{enumerate}
A morphism $(X' \to S', \mathcal{L}') \to (X \to S, \mathcal{L})$
between objects
is given by a triple $(f, g, \varphi)$ where $f : X' \to X$ and $g : S' \to S$
are morphisms of schemes which fit into a commutative diagram
$$
\xymatrix{
X' \ar[d] \ar[r]_f & X \ar[d] \\
S' \ar[r]^g & S
}
$$
inducing an isomorphism $X' \to S' \times_S X$, in other words, the
diagram is cartesian,
and $\varphi : f^*\mathcal{L} \to \mathcal{L}'$ is an isomorphism.
Composition is defined in the obvious manner (see
Examples of Stacks, Sections
\ref{examples-stacks-section-stack-of-spaces} and
\ref{examples-stacks-section-stack-of-quasi-coherent-sheaves}).
The forgetful functor
$$
p : \Polarizedstack \longrightarrow \Sch_{fppf},\quad
(X \to S, \mathcal{L}) \longmapsto S
$$
is how we view $\Polarizedstack$ as a category over $\Sch_{fppf}$
(see Section \ref{section-conventions} for notation).
\end{situation}

\noindent
In the previous section we have done a substantial amount of work on the stack
$\Spacesstack'_{fp, flat, proper}$
of finitely presented, flat, proper algebraic spaces. To use this material
we consider the forgetful functor
\begin{equation}
\label{equation-over-proper-spaces}
\Polarizedstack \longrightarrow
\Spacesstack'_{fp, flat, proper},\quad
(X \to S, \mathcal{L}) \longmapsto (X \to S)
\end{equation}
This functor will be a useful tool in what follows.
Observe that if $(X \to S)$ is in the essential image
of (\ref{equation-over-proper-spaces}), then
$X$ and $S$ are schemes.

\begin{lemma}
\label{lemma-polarized-fibred-in-groupoids}
The category $\Polarizedstack$ is fibred in groupoids over
$\Spacesstack'_{fp, flat, proper}$.
The category $\Polarizedstack$ is fibred in groupoids over $\Sch_{fppf}$.
\end{lemma}

\begin{proof}
We check conditions (1) and (2) of
Categories, Definition \ref{categories-definition-fibred-groupoids}.

\medskip\noindent
Condition (1). Let $(X \to S, \mathcal{L})$ be an object of
$\Polarizedstack$ and let $(X' \to S') \to (X \to S)$
be a morphism of $\Spacesstack'_{fp, flat, proper}$. Then we
let $\mathcal{L}'$ be the pullback of $\mathcal{L}$ to $X'$.
Observe that $X, S, S'$ are schemes, hence $X'$ is a scheme
as well (as the fibre product of schemes). Then
$\mathcal{L}'$ is ample on $X'/S'$ by
Morphisms, Lemma \ref{morphisms-lemma-ample-base-change}.
In this way we obtain a morphism
$(X' \to S', \mathcal{L}') \to (X \to S, \mathcal{L})$
lying over $(X' \to S') \to (X \to S)$.

\medskip\noindent
Condition (2). Consider morphisms
$(f, g, \varphi) : (X' \to S', \mathcal{L}') \to (X \to S, \mathcal{L})$ and
$(a, b, \psi) : (Y \to T, \mathcal{N}) \to (X \to S, \mathcal{L})$
of $\Polarizedstack$. Given a morphism $(k, h) : (Y \to T) \to (X' \to S')$
of $\Spacesstack'_{fp, flat, proper}$
with $(f, g) \circ (k, h) = (a, b)$ we have to show
there is a unique morphism
$(k, h, \chi) : (Y \to T, \mathcal{N}) \to (X' \to S', \mathcal{L}')$
of $\Polarizedstack$ such that
$(f, g, \varphi) \circ (k, h, \chi) = (a, b, \psi)$.
We can just take
$$
\chi = \psi \circ (k^*\varphi)^{-1}
$$
This proves condition (2). A composition of functors defining
fibred categories defines a fibred category, see
Categories, Lemma \ref{categories-lemma-fibred-over-fibred}.
This we see that $\Polarizedstack$ is fibred in groupoids over
$\Sch_{fppf}$ (strictly speaking we should check the fibre
categories are groupoids and apply
Categories, Lemma \ref{categories-lemma-fibred-groupoids}).
\end{proof}

\begin{lemma}
\label{lemma-polarized-stack}
The category $\Polarizedstack$ is a stack in groupoids over
$\Spacesstack'_{fp, flat, proper}$ (endowed with the inherited topology,
see Stacks, Definition \ref{stacks-definition-topology-inherited}).
The category $\Polarizedstack$ is a stack in groupoids over $\Sch_{fppf}$.
\end{lemma}

\begin{proof}
We prove $\Polarizedstack$ is a stack in groupoids over
$\Spacesstack'_{fp, flat, proper}$
by checking conditions (1), (2), and (3)
of Stacks, Definition \ref{stacks-definition-stack-in-groupoids}.
We have already seen (1) in
Lemma \ref{lemma-polarized-fibred-in-groupoids}.

\medskip\noindent
A covering of $\Spacesstack'_{fp, flat, proper}$ comes about
in the following manner: Let $X \to S$ be an object of
$\Spacesstack'_{fp, flat, proper}$. Suppose that
$\{S_i \to S\}_{i \in I}$ is a covering of $\Sch_{fppf}$.
Set $X_i = S_i \times_S X$. Then $\{(X_i \to S_i) \to (X \to S)\}_{i \in I}$
is a covering of $\Spacesstack'_{fp, flat, proper}$ and
every covering of $\Spacesstack'_{fp, flat, proper}$ is isomorphic
to one of these. Set $S_{ij} = S_i \times_S S_j$ and
$X_{ij} = S_{ij} \times_S X$ so that $(X_{ij} \to S_{ij}) =
(X_i \to S_i) \times_{(X \to S)} (X_j \to S_j)$.
Next, suppose that $\mathcal{L}, \mathcal{N}$
are ample invertible sheaves on $X/S$ so that
$(X \to S, \mathcal{L})$ and $(X \to S, \mathcal{N})$
are two objects of $\Polarizedstack$ over the object $(X \to S)$.
To check descent for morphisms, we assume we have morphisms
$(\text{id}, \text{id}, \varphi_i)$ from
$(X_i \to S_i, \mathcal{L}|_{X_i})$ to
$(X_i \to S_i, \mathcal{N}|_{X_i})$
whose base changes to morphisms from
$(X_{ij} \to S_{ij}, \mathcal{L}|_{X_{ij}})$ to
$(X_{ij} \to S_{ij}, \mathcal{N}|_{X_{ij}})$
agree. Then
$\varphi_i : \mathcal{L}|_{X_i} \to \mathcal{N}|_{X_i}$
are isomorphisms of invertible modules over $X_i$ such that
$\varphi_i$ and $\varphi_j$ restrict to the same
isomorphisms over $X_{ij}$.
By descent for quasi-coherent sheaves
(Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent})
we obtain a unique isomorphism $\varphi : \mathcal{L} \to \mathcal{N}$
whose restriction to $X_i$ recovers $\varphi_i$.

\medskip\noindent
Decent for objects is proved in exactly the same manner.
Namely, suppose that
$\{(X_i \to S_i) \to (X \to S)\}_{i \in I}$
is a covering of $\Spacesstack'_{fp, flat, proper}$
as above.
Suppose we have objects $(X_i \to S_i, \mathcal{L}_i)$
of $\Polarizedstack$ lying over $(X_i \to S_i)$
and a descent datum
$$
(\text{id}, \text{id}, \varphi_{ij}) :
(X_{ij} \to S_{ij}, \mathcal{L}_i|_{X_{ij}})
\to
(X_{ij} \to S_{ij}, \mathcal{L}_j|_{X_{ij}})
$$
satisfying the obvious cocycle condition over
$(X_{ijk} \to S_{ijk})$ for every triple of indices.
Then by
 descent for quasi-coherent sheaves
(Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent})
we obtain a unique invertible $\mathcal{O}_X$-module
$\mathcal{L}$ and isomorphisms $\mathcal{L}|_{X_i} \to \mathcal{L}_i$
recovering the descent datum $\varphi_{ij}$.
To show that
$(X \to S, \mathcal{L})$ is an object of
$\Polarizedstack$ we have to prove that
$\mathcal{L}$ is ample. This follows from
Descent on Spaces, Lemma \ref{spaces-descent-lemma-descending-property-ample}.

\medskip\noindent
Since we already have seen that $\Spacesstack'_{fp, flat, proper}$
is a stack in groupoids over $\Sch_{fppf}$
(Lemma \ref{lemma-spaces-stack}) it now follows formally
that $\Polarizedstack$ is a stack in groupoids over $\Sch_{fppf}$.
See Stacks, Lemma \ref{stacks-lemma-stack-over-stack}.
\end{proof}

\noindent
Sanity check: the stack $\Polarizedstack$ plays
the same role among algebraic spaces.

\begin{lemma}
\label{lemma-extend-polarized-to-spaces}
Let $T$ be an algebraic space over $\mathbf{Z}$. Let $\mathcal{S}_T$
denote the corresponding algebraic stack (Algebraic Stacks, Sections
\ref{algebraic-section-split},
\ref{algebraic-section-representable-by-algebraic-spaces}, and
\ref{algebraic-section-stacks-spaces}).
We have an equivalence of categories
$$
\left\{
\begin{matrix}
(X \to T, \mathcal{L})\text{ where }X \to T\text{ is a morphism}\\
\text{of algebraic spaces, is proper, flat, and of}\\
\text{finite presentation and }\mathcal{L}\text{ ample on }X/T
\end{matrix}
\right\}
\longrightarrow
\Mor_{\textit{Cat}/\Sch_{fppf}}(\mathcal{S}_T, \Polarizedstack)
$$
\end{lemma}

\begin{proof}
Omitted. Hints: Argue exactly as in the proof of
Lemma \ref{lemma-extend-spaces-to-spaces} and use
Descent on Spaces, Proposition
\ref{spaces-descent-proposition-fpqc-descent-quasi-coherent}
to descent the invertible sheaf in the construction
of the quasi-inverse functor. The relative ampleness property descends
by Descent on Spaces, Lemma
\ref{spaces-descent-lemma-descending-property-ample}.
\end{proof}

\begin{remark}
\label{remark-polarized-base-change}
Let $B$ be an algebraic space over $\Spec(\mathbf{Z})$.
Let $B\textit{-Polarized}$ be the category consisting
of triples $(X \to S, \mathcal{L}, h : S \to B)$
where $(X \to S, \mathcal{L})$ is an object of
$\Polarizedstack$ and $h : S \to B$ is a morphism.
A morphism $(X' \to S', \mathcal{L}', h') \to (X \to S, \mathcal{L}, h)$
in $B\textit{-Polarized}$ is a morphism $(f, g, \varphi)$
in $\Polarizedstack$ such that $h \circ g = h'$.
In this situation the diagram
$$
\xymatrix{
B\textit{-Polarized} \ar[r] \ar[d] & \Polarizedstack \ar[d] \\
(\Sch/B)_{fppf} \ar[r] & \Sch_{fppf}
}
$$
is $2$-fibre product square. This trivial remark
will occasionally be useful to deduce results from
the absolute case $\Polarizedstack$ to the case
of families over a given base algebraic space.
\end{remark}

\begin{lemma}
\label{lemma-polarized-to-spaces-algebraic}
The functor (\ref{equation-over-proper-spaces}) defines a $1$-morphism
$$
\Polarizedstack \to \Spacesstack'_{fp, flat, proper}
$$
of stacks in groupoids over $\Sch_{fppf}$
which is algebraic in the sense of
Criteria for Representability, Definition
\ref{criteria-definition-algebraic}.
\end{lemma}

\begin{proof}
By Lemmas \ref{lemma-spaces-stack} and \ref{lemma-polarized-stack}
the statement makes sense. To prove it, we choose a scheme $S$
and an object $\xi = (X \to S)$ of $\Spacesstack'_{fp, flat, proper}$
over $S$. We have to show that
$$
\mathcal{X} = (\Sch/S)_{fppf} \times_{\xi, \Spacesstack'_{fp, flat, proper}}
\Polarizedstack
$$
is an algebraic stack over $S$. Observe that an object of $\mathcal{X}$
is given by a pair $(T/S, \mathcal{L})$ where $T$ is a scheme
over $S$ and $\mathcal{L}$ is an invertible $\mathcal{O}_{X_T}$-module
which is ample on $X_T/T$. Morphisms are defined in the obvious manner.
In particular, we see immediately that we have an inclusion
$$
\mathcal{X} \subset \Picardstack_{X/S}
$$
of categories over $(\Sch/S)_{fppf}$, inducing equality on morphism
sets. Since $\Picardstack_{X/S}$ is an algebraic stack by
Proposition \ref{proposition-pic} it suffices to show that the inclusion
above is representable by open immersions. This is exactly the content
of Descent on Spaces, Lemma
\ref{spaces-descent-lemma-ample-in-neighbourhood}.
\end{proof}

\begin{lemma}
\label{lemma-polarized-diagonal}
The diagonal
$$
\Delta : \Polarizedstack \longrightarrow
\Polarizedstack \times \Polarizedstack
$$
is representable by algebraic spaces.
\end{lemma}

\begin{proof}
This is a formal consequence of
Lemmas \ref{lemma-polarized-to-spaces-algebraic} and
\ref{lemma-spaces-diagonal}.
See Criteria for Representability, Lemma
\ref{criteria-lemma-diagonals-and-algebraic-morphisms}.
\end{proof}

\begin{lemma}
\label{lemma-polarized-limits}
The stack in groupoids $\Polarizedstack$ is limit preserving
(Artin's Axioms, Definition \ref{artin-definition-limit-preserving}).
\end{lemma}

\begin{proof}
Let $I$ be a directed set and let $(A_i, \varphi_{ii'})$
be a system of rings over $I$. Set $S = \Spec(A)$ and
$S_i = \Spec(A_i)$. We have to show that on fibre categories we have
$$
\Polarizedstack_S = \colim \Polarizedstack_{S_i}
$$
We know that the category of schemes of finite presentation over
$S$ is the colimit of the category of schemes of finite presentation
over $S_i$, see
Limits, Lemma \ref{limits-lemma-descend-finite-presentation}.
Moreover, given $X_i \to S_i$ of finite presentation, with
limit $X \to S$, then the category of invertible
$\mathcal{O}_X$-modules $\mathcal{L}$ is the colimit of the categories
of invertible $\mathcal{O}_{X_i}$-modules $\mathcal{L}_i$, see
Limits, Lemma \ref{limits-lemma-descend-modules-finite-presentation} and
\ref{limits-lemma-descend-invertible-modules}.
If $X \to S$ is proper and flat, then for sufficiently large
$i$ the morphism $X_i \to S_i$ is proper and flat too, see
Limits, Lemmas \ref{limits-lemma-eventually-proper} and
\ref{limits-lemma-descend-flat-finite-presentation}.
Finally, if $\mathcal{L}$ is ample on $X$
then $\mathcal{L}_i$ is ample on $X_i$ for
$i$ sufficiently large, see
Limits, Lemma \ref{limits-lemma-limit-ample}.
Putting everything together finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-polarized-RS-star}
In Situation \ref{situation-coherent}. Let
$$
\xymatrix{
T \ar[r] \ar[d] & T' \ar[d] \\
S \ar[r] & S'
}
$$
be a pushout in the category of schemes where
$T \to T'$ is a thickening and $T \to S$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the functor on fibre categories
$$
\Polarizedstack_{S'}
\longrightarrow
\Polarizedstack_S \times_{\Polarizedstack_T} \Polarizedstack_{T'}
$$
is an equivalence.
\end{lemma}

\begin{proof}
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-equivalence-categories-schemes-over-pushout-flat}
there is an equivalence
$$
\textit{flat-lfp}_{S'}
\longrightarrow
\textit{flat-lfp}_S \times_{\textit{flat-lfp}_T} \textit{flat-lfp}_{T'}
$$
where $\textit{flat-lfp}_S$ signifies the category of schemes flat
and locally of finite presentation over $S$.
Let $X'/S'$ on the left hand side correspond to the triple
$(X/S, Y'/T', \varphi)$ on the right hand side.
Set $Y = T \times_{T'} Y'$ which is isomorphic with
$T \times_S X$ via $\varphi$. Then More on Morphisms, Lemma
\ref{more-morphisms-lemma-scheme-over-pushout-flat-modules}
shows that we have an equivalence
$$
\textit{QCoh-flat}_{X'/S'}
\longrightarrow
\textit{QCoh-flat}_{X/S}
\times_{\textit{QCoh-flat}_{Y/T}} \textit{QCoh-flat}_{Y'/T'}
$$
where $\textit{QCoh-flat}_{X/S}$ signifies the category of
quasi-coherent $\mathcal{O}_X$-modules flat over $S$.
Since $X \to S$, $Y \to T$, $X' \to S'$, $Y' \to T'$ are
flat, this will in particular apply to invertible modules
to give an equivalence of categories
$$
\textit{Pic}(X')
\longrightarrow
\textit{Pic}(X) \times_{\textit{Pic}(Y)} \textit{Pic}(Y')
$$
where $\textit{Pic}(X)$ signifies the category of invertible
$\mathcal{O}_X$-modules. There is a small point here:
one has to show that if an object $\mathcal{F}'$
of $\textit{QCoh-flat}_{X'/S'}$
pulls back to invertible modules on $X$ and $Y'$, then
$\mathcal{F}'$ is an invertible $\mathcal{O}_{X'}$-module.
It follows from the cited lemma that $\mathcal{F}'$
is an $\mathcal{O}_{X'}$-module of finite presentation.
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-flat-and-free-at-point-fibre}
it suffices to check the restriction of
$\mathcal{F}'$ to fibres of $X' \to S'$ is invertible.
But the fibres of $X' \to S'$ are the same as the fibres
of $X \to S$ and hence these restrictions are invertible.

\medskip\noindent
Having said the above we obtain an equivalence of categories if we drop
the assumption (for the category of objects over $S$) that $X \to S$ be proper
and the assumption that $\mathcal{L}$ be ample.
Now it is clear that if $X' \to S'$ is proper, then
$X \to S$ and $Y' \to T'$ are proper (Morphisms, Lemma
\ref{morphisms-lemma-base-change-proper}).
Conversely, if $X \to S$ and $Y' \to T'$ are proper, then
$X' \to S'$ is proper by
More on Morphisms, Lemma
\ref{more-morphisms-lemma-thicken-property-morphisms-cartesian}.
Similarly, if $\mathcal{L}'$ is ample on $X'/S'$, then
$\mathcal{L}'|_X$ is ample on $X/S$ and
$\mathcal{L}'|_{Y'}$ is ample on $Y'/T'$
(Morphisms, Lemma \ref{morphisms-lemma-ample-base-change}).
Finally, if $\mathcal{L}'|_X$ is ample on $X/S$ and
$\mathcal{L}'|_{Y'}$ is ample on $Y'/T'$, then
$\mathcal{L}'$ is ample on $X'/S'$ by
More on Morphisms, Lemma
\ref{more-morphisms-lemma-thicken-property-relatively-ample}.
\end{proof}

\begin{lemma}
\label{lemma-polarized-tangent-space}
Let $k$ be a field and let $x = (X \to \Spec(k), \mathcal{L})$
be an object of $\mathcal{X} = \Polarizedstack$ over $\Spec(k)$.
\begin{enumerate}
\item If $k$ is of finite type over $\mathbf{Z}$, then
the vector spaces $T\mathcal{F}_{\mathcal{X}, k, x}$ and
$\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x})$
(see Artin's Axioms, Section \ref{artin-section-tangent-spaces})
are finite dimensional, and
\item in general the vector spaces $T_x(k)$ and $\text{Inf}_x(k)$
(see Artin's Axioms, Section \ref{artin-section-inf})
are finite dimensional.
\end{enumerate}
\end{lemma}

\begin{proof}
The discussion in Artin's Axioms, Section \ref{artin-section-tangent-spaces}
only applies to fields of finite type over the base scheme $\Spec(\mathbf{Z})$.
Our stack satisfies (RS*) by Lemma \ref{lemma-polarized-RS-star}
and we may apply
Artin's Axioms, Lemma \ref{artin-lemma-properties-lift-RS-star}
to get the vector spaces $T_x(k)$ and $\text{Inf}_x(k)$
mentioned in (2). Moreover, in the finite type case these spaces agree with the
ones mentioned in part (1)
by Artin's Axioms, Remark \ref{artin-remark-compare-deformation-spaces}.
With this out of the way we can start the proof.

\medskip\noindent
One proof is to use an argument as in the proof of
Lemma \ref{lemma-spaces-tangent-space}; this would
require us to develop a deformation theory for pairs
consisting of a scheme and a quasi-coherent module.
Another proof would be the use the result from
Lemma \ref{lemma-spaces-tangent-space},
the algebraicity of
$\Polarizedstack \to \Spacesstack'_{fp, flat, proper}$,
and a computation of the deformation space of an
invertible module. However, what we will do instead
is to translate the question into a deformation question
on graded $k$-algebras and deduce the result that way.

\medskip\noindent
Let $\mathcal{C}_k$ be the category of Artinian local $k$-algebras
$A$ with residue field $k$. We get a predeformation category
$p : \mathcal{F} \to \mathcal{C}_k$ from our object $x$ of $\mathcal{X}$
over $k$, see
Artin's Axioms, Section \ref{artin-section-predeformation-categories}.
Thus $\mathcal{F}(A)$ is the category of triples
$(X_A, \mathcal{L}_A, \alpha)$, where $(X_A, \mathcal{L}_A)$
is an object of $\Polarizedstack$ over $A$ and $\alpha$ is an isomorphism
$(X_A, \mathcal{L}_A) \times_{\Spec(A)} \Spec(k) \cong (X, \mathcal{L})$.
On the other hand, let $q : \mathcal{G} \to \mathcal{C}_k$
be the category cofibred in groupoids defined in
Deformation Problems, Example \ref{examples-defos-example-graded-algebras}.
Choose $d_0 \gg 0$ (we'll see below how large).
Let $P$ be the graded $k$-algebra
$$
P = k \oplus \bigoplus\nolimits_{d \geq d_0} H^0(X, \mathcal{L}^{\otimes d})
$$
Then $y = (k, P)$ is an object of $\mathcal{G}(k)$.
Let $\mathcal{G}_y$ be the predeformation category of
Formal Deformation Theory, Remark
\ref{formal-defos-remark-localize-cofibered-groupoid}.
Given $(X_A, \mathcal{F}_A, \alpha)$ as above we set
$$
Q = A \oplus \bigoplus\nolimits_{d \geq d_0} H^0(X_A, \mathcal{L}_A^{\otimes d})
$$
The isomorphism $\alpha$ induces a map $\beta : Q \to P$.
By deformation theory of projective schemes
(More on Morphisms, Lemma \ref{more-morphisms-lemma-deform-projective})
we obtain a $1$-morphism
$$
\mathcal{F} \longrightarrow \mathcal{G}_y,\quad
(X_A, \mathcal{F}_A, \alpha) \longmapsto (Q, \beta : Q \to P)
$$
of categories cofibred in groupoids over $\mathcal{C}_k$.
In fact, this functor is an equivalence with quasi-inverse
given by $Q \mapsto \underline{\text{Proj}}_A(Q)$.
Namely, the scheme $X_A = \underline{\text{Proj}}_A(Q)$
is flat over $A$ by Divisors, Lemma \ref{divisors-lemma-relative-proj-flat}.
Set $\mathcal{L}_A = \mathcal{O}_{X_A}(1)$; this is flat over $A$
by the same lemma. We get an isomorphism
$(X_A, \mathcal{L}_A) \times_{\Spec(A)} \Spec(k) = (X, \mathcal{L})$
from $\beta$. Then we can deduce all the desired properties of
the pair $(X_A, \mathcal{L}_A)$ from the corresponding properties
of $(X, \mathcal{L})$ using the techniques in
More on Morphisms, Sections
\ref{more-morphisms-section-morphisms-thickenings} and
\ref{more-morphisms-section-deform}.
Some details omitted.

\medskip\noindent
In conclusion, we see that $T\mathcal{F} = T\mathcal{G}_y = T_y\mathcal{G}$
and $\text{Inf}(\mathcal{F}) = \text{Inf}_y(\mathcal{G})$.
These vector spaces are finite dimensional by Deformation Problems, Lemma
\ref{examples-defos-lemma-graded-algebras-TI}
and the proof is complete.
\end{proof}

\begin{lemma}[Strong formal effectiveness for polarized schemes]
\label{lemma-polarized-strong-effectiveness}
\begin{slogan}
Grothendieck's algebraization theorem continues to hold in
the non-Noetherian setting if one assumes flatness and
finite presentation.
\end{slogan}
Let $(R_n)$ be an inverse system of rings with surjective transition maps
whose kernels are locally nilpotent. Set $R = \lim R_n$.
Set $S_n = \Spec(R_n)$ and $S = \Spec(R)$. Consider a commutative diagram
$$
\xymatrix{
X_1 \ar[r]_{i_1} \ar[d] & X_2 \ar[r]_{i_2} \ar[d] & X_3 \ar[r] \ar[d] &
\ldots \\
S_1 \ar[r] & S_2 \ar[r] & S_3 \ar[r] & \ldots
}
$$
of schemes with cartesian squares. Suppose given $(\mathcal{L}_n, \varphi_n)$
where each $\mathcal{L}_n$ is an invertible sheaf on $X_n$ and
$\varphi_n : i_n^*\mathcal{L}_{n + 1} \to \mathcal{L}_n$ is an isomorphism.
If
\begin{enumerate}
\item $X_n \to S_n$ is proper, flat, of finite presentation, and
\item $\mathcal{L}_1$ is ample on $X_1$
\end{enumerate}
then there exists a morphism of schemes $X \to S$
proper, flat, and of finite presentation
and an ample invertible $\mathcal{O}_X$-module $\mathcal{L}$
and isomorphisms $X_n \cong X \times_S S_n$ and
$\mathcal{L}_n \cong \mathcal{L}|_{X_n}$ compatible with
the morphisms $i_n$ and $\varphi_n$.
\end{lemma}

\begin{proof}
Choose $d_0$ for $X_1 \to S_1$ and $\mathcal{L}_1$ as in
More on Morphisms, Lemma \ref{more-morphisms-lemma-deform-projective}.
For any $n \geq 1$ set
$$
A_n = R_n \oplus
\bigoplus\nolimits_{d \geq d_0} H^0(X_n, \mathcal{L}_n^{\otimes d})
$$
By the lemma each $A_n$ is a finitely presented graded $R_n$-algebra
whose homogeneous parts $(A_n)_d$ are finite projective $R_n$-modules
such that $X_n = \text{Proj}(A_n)$ and
$\mathcal{L}_n = \mathcal{O}_{\text{Proj}(A_n)}(1)$.
The lemma also guarantees that the maps
$$
A_1 \leftarrow A_2 \leftarrow A_3 \leftarrow \ldots
$$
induce isomorphisms $A_n = A_m \otimes_{R_m} R_n$ for $n \leq m$.
We set
$$
B = \bigoplus\nolimits_{d \geq 0} B_d
\quad\text{with}\quad
B_d = \lim_n (A_n)_d
$$
By More on Algebra, Lemma
\ref{more-algebra-lemma-lim-finite-projective-gives-finite-projective}
we see that $B_d$ is a finite projective $R$-module and that
$B \otimes_R R_n = A_n$. Thus the scheme
$$
X = \text{Proj}(B)
\quad\text{and}\quad
\mathcal{L} = \mathcal{O}_X(1)
$$
is flat over $S$ and $\mathcal{L}$ is a quasi-coherent $\mathcal{O}_X$-module
flat over $S$, see
Divisors, Lemma \ref{divisors-lemma-relative-proj-flat}.
Because formation of Proj commutes with base change
(Constructions, Lemma \ref{constructions-lemma-base-change-map-proj})
we obtain canonical isomorphisms
$$
X \times_S S_n = X_n
\quad\text{and}\quad
\mathcal{L}|_{X_n} \cong \mathcal{L}_n
$$
compatible with the transition maps of the system.
Thus we may think of $X_1 \subset X$ as a closed subscheme.
Below we will show that $B$ is of finite presentation over $R$.
By Divisors, Lemmas \ref{divisors-lemma-relative-proj-proper} and
\ref{divisors-lemma-relative-proj-finite-presentation}
this implies that $X \to S$ is of finite presentation
and proper and that $\mathcal{L} = \mathcal{O}_X(1)$
is of finite presentation as an $\mathcal{O}_X$-module.
Since the restriction of $\mathcal{L}$ to the base change
$X_1 \to S_1$ is invertible, we see from
More on Morphisms, Lemma \ref{more-morphisms-lemma-finite-free-open}
that $\mathcal{L}$ is invertible on an open neighbourhood of $X_1$ in $X$.
Since $X \to S$ is closed and since $\Ker(R \to R_1)$
is contained in the Jacobson radical
(More on Algebra, Lemma \ref{more-algebra-lemma-limit-henselian})
we see that any open neighbourhood of $X_1$ in $X$ is equal to $X$.
Thus $\mathcal{L}$ is invertible. Finally, the set of points in
$S$ where $\mathcal{L}$ is ample on the fibre is open in $S$
(More on Morphisms, Lemma \ref{more-morphisms-lemma-ample-in-neighbourhood})
and contains $S_1$ hence equals $S$. Thus $X \to S$ and $\mathcal{L}$
have all the properties required of them in the statement of the lemma.

\medskip\noindent
We prove the claim above.
Choose a presentation $A_1 = R_1[X_1, \ldots, X_s]/(F_1, \ldots, F_t)$
where $X_i$ are variables having degrees $d_i$ and $F_j$
are homogeneous polynomials in $X_i$ of degree $e_j$.
Then we can choose a map
$$
\Psi : R[X_1, \ldots, X_s] \longrightarrow B
$$
lifting the map $R_1[X_1, \ldots, X_s] \to A_1$. Since each $B_d$
is finite projective over $R$ we conclude from 
Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}
using again that $\Ker(R \to R_1)$ is contained in the Jacobson radical
of $R$) that $\Psi$ is surjective. Since $- \otimes_R R_1$ is right
exact we can find $G_1, \ldots, G_t \in \Ker(\Psi)$
mapping to $F_1, \ldots, F_t$ in $R_1[X_1, \ldots, X_s]$.
Observe that $\Ker(\Psi)_d$ is a finite projective $R$-module
for all $d \geq 0$ as the kernel of the surjection
$R[X_1, \ldots, X_s]_d \to B_d$ of finite projective $R$-modules.
We conclude from Nakayama's lemma once more that 
$\Ker(\Psi)$ is generated by $G_1, \ldots, G_t$.
\end{proof}

\begin{lemma}
\label{lemma-polarized-existence}
Consider the stack $\Polarizedstack$ over the base
scheme $\Spec(\mathbf{Z})$. Then every formal object is effective.
\end{lemma}

\begin{proof}
For definitions of the notions in the lemma, please see
Artin's Axioms, Section \ref{artin-section-formal-objects}.
From the definitions we see the lemma follows immediately
from the more general Lemma \ref{lemma-polarized-strong-effectiveness}.
\end{proof}

\begin{lemma}
\label{lemma-polarized-defo-thy}
The stack in groupoids $\Polarizedstack$
satisfies openness of versality over $\Spec(\mathbf{Z})$.
Similarly, after base change (Remark \ref{remark-polarized-base-change})
openness of versality holds over any Noetherian base scheme $S$.
\end{lemma}

\begin{proof}
This follows from
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}
and Lemmas \ref{lemma-polarized-diagonal},
\ref{lemma-polarized-RS-star},
\ref{lemma-polarized-limits}, and
\ref{lemma-polarized-strong-effectiveness}.
For the ``usual'' proof of this fact, please see the discussion
in the remark following this proof.
\end{proof}

\begin{remark}
\label{remark-polarized-defo-thy}
Lemma \ref{lemma-polarized-defo-thy} can also be shown
using an obstruction theory as in
Artin's Axioms, Lemma \ref{artin-lemma-get-openness-obstruction-theory}
(as in the second proof of Lemma \ref{lemma-coherent-defo-thy}).
To do this one has to generalize the deformation and obstruction theory
developed in
Cotangent, Section \ref{cotangent-section-deformations-ringed-topoi}
to the case of pairs of algebraic spaces and quasi-coherent modules.
Another possibility is to use that the $1$-morphism
$\Polarizedstack \to \Spacesstack'_{fp, flat, proper}$
is algebraic (Lemma \ref{lemma-polarized-to-spaces-algebraic})
and the fact that we know openness of versality for the target
(Lemma \ref{lemma-spaces-defo-thy} and
Remark \ref{remark-spaces-defo-thy}).
\end{remark}

\begin{theorem}[Algebraicity of the stack of polarized schemes]
\label{theorem-polarized-algebraic}
The stack $\Polarizedstack$ (Situation \ref{situation-polarized})
is algebraic. In fact, for any algebraic space $B$ the stack
$B\textit{-Polarized}$ (Remark \ref{remark-polarized-base-change})
is algebraic.
\end{theorem}

\begin{proof}
The absolute case follows from
Artin's Axioms, Lemma \ref{artin-lemma-diagonal-representable}
and Lemmas \ref{lemma-polarized-diagonal},
\ref{lemma-polarized-RS-star},
\ref{lemma-polarized-limits},
\ref{lemma-polarized-existence}, and
\ref{lemma-polarized-defo-thy}.
The case over $B$ follows from this, the description of
$B\textit{-Polarized}$ as a $2$-fibre product in
Remark \ref{remark-polarized-base-change}, and the fact
that algebraic stacks have $2$-fibre products, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-2-fibre-product}.
\end{proof}











\section{The stack of curves}
\label{section-curves}

\noindent
In this section we prove the stack of curves is algebraic. For
a further discussion of moduli of curves, we refer the reader
to Moduli of Curves, Section \ref{moduli-curves-section-introduction}.

\medskip\noindent
A curve in the Stacks project is a variety of dimension $1$.
However, when we speak of families of curves, we often allow
the fibres to be reducible and/or nonreduced. In this section,
the stack of curves will ``parametrize proper schemes of
dimension $\leq 1$''. However, it turns out that in order
to get the correct notion of a family we need to allow the
total space of our family to be an algebraic space.
This leads to the following definition.

\begin{situation}
\label{situation-curves}
We define a category $\Curvesstack$ as follows:
\begin{enumerate}
\item Objects are {\it families of curves}. More precisely, an
object is a morphism $f : X \to S$ where the base $S$ is a scheme,
the {\it total space} $X$ is an algebraic space, and
$f$ is flat, proper, of finite presentation,
and has relative dimension $\leq 1$ (Morphisms of Spaces, Definition
\ref{spaces-morphisms-definition-relative-dimension}).
\item A morphism $(X' \to S') \to (X \to S)$ between objects
is given by a pair $(f, g)$ where $f : X' \to X$ is a morphism
of algebraic spaces and $g : S' \to S$ is a morphism of schemes
which fit into a commutative diagram
$$
\xymatrix{
X' \ar[d] \ar[r]_f & X \ar[d] \\
S' \ar[r]^g & S
}
$$
inducing an isomorphism $X' \to S' \times_S X$, in other words, the
diagram is cartesian.
\end{enumerate}
The forgetful functor
$$
p : \Curvesstack \longrightarrow \Sch_{fppf},\quad
(X \to S) \longmapsto S
$$
is how we view $\Curvesstack$ as a category over $\Sch_{fppf}$
(see Section \ref{section-conventions} for notation).
\end{situation}

\noindent
It follows from Spaces over Fields, Lemma
\ref{spaces-over-fields-lemma-codim-1-point-in-schematic-locus}
and more generally
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-projective-over-complete}
that if $S$ is the spectrum of a field, or an Artinian local ring,
or a Noetherian complete local ring, then for any family of curves
$X \to S$ the total space $X$ is a scheme.
On the other hand, there are families of curves
over $\mathbf{A}^1_k$ where the total space is not a scheme, see
Examples, Section \ref{examples-section-family-of-curves}.

\medskip\noindent
It is clear that
\begin{equation}
\label{equation-curves-over-proper-spaces}
\Curvesstack \subset \Spacesstack'_{fp, flat, proper}
\end{equation}
and that an object $X \to S$ of $\Spacesstack'_{fp, flat, proper}$
is in $\Curvesstack$ if and only if $X \to S$ has relative
dimension $\leq 1$. We will use this to verify Artin's axioms
for $\Curvesstack$.

\begin{lemma}
\label{lemma-curves-fibred-in-groupoids}
The category $\Curvesstack$ is fibred in groupoids over $\Sch_{fppf}$.
\end{lemma}

\begin{proof}
Using the embedding (\ref{equation-curves-over-proper-spaces}),
the description of the image, and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-fibred-in-groupoids})
this reduces to the following statement: Given a morphism
$$
\xymatrix{
X' \ar[r] \ar[d] & X \ar[d] \\
S' \ar[r] & S
}
$$
in $\Spacesstack'_{fp, flat, proper}$ (recall that this implies
in particular the diagram is cartesian)
if $X \to S$ has relative dimension $\leq 1$, then $X' \to S'$
has relative dimension $\leq 1$.
This follows from Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-dimension-fibre-after-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-curves-stack}
The category $\Curvesstack$ is a stack in groupoids over $\Sch_{fppf}$.
\end{lemma}

\begin{proof}
Using the embedding (\ref{equation-curves-over-proper-spaces}),
the description of the image, and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-stack})
this reduces to the following statement: Given an object
$X \to S$ of $\Spacesstack'_{fp, flat, proper}$
and an fppf covering $\{S_i \to S\}_{i \in I}$
the following are equivalent:
\begin{enumerate}
\item $X \to S$ has relative dimension $\leq 1$, and
\item for each $i$ the base change $X_i \to S_i$
has relative dimension $\leq 1$.
\end{enumerate}
This follows from Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-dimension-fibre-after-base-change}.
\end{proof}

\begin{lemma}
\label{lemma-curves-diagonal}
The diagonal
$$
\Delta : \Curvesstack \longrightarrow \Curvesstack \times \Curvesstack
$$
is representable by algebraic spaces.
\end{lemma}

\begin{proof}
This is immediate from the fully faithful embedding
(\ref{equation-curves-over-proper-spaces}) and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-diagonal}).
\end{proof}

\begin{remark}
\label{remark-curves-base-change}
Let $B$ be an algebraic space over $\Spec(\mathbf{Z})$.
Let $B\text{-}\Curvesstack$ be the category consisting
of pairs $(X \to S, h : S \to B)$
where $X \to S$ is an object of
$\Curvesstack$ and $h : S \to B$ is a morphism.
A morphism $(X' \to S', h') \to (X \to S, h)$
in $B\text{-}\Curvesstack$ is a morphism $(f, g)$
in $\Curvesstack$ such that $h \circ g = h'$.
In this situation the diagram
$$
\xymatrix{
B\text{-}\Curvesstack \ar[r] \ar[d] & \Curvesstack \ar[d] \\
(\Sch/B)_{fppf} \ar[r] & \Sch_{fppf}
}
$$
is $2$-fibre product square. This trivial remark
will occasionally be useful to deduce results from
the absolute case $\Curvesstack$ to the case
of families of curves over a given base algebraic space.
\end{remark}

\begin{lemma}
\label{lemma-curves-limits}
The stack $\Curvesstack \to \Sch_{fppf}$ is limit preserving
(Artin's Axioms, Definition \ref{artin-definition-limit-preserving}).
\end{lemma}

\begin{proof}
Using the embedding (\ref{equation-curves-over-proper-spaces}),
the description of the image, and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-limits})
this reduces to the following statement:
Let $T = \lim T_i$ be the limits of a
directed inverse system of affine schemes.
Let $i \in I$ and let $X_i \to T_i$ be an object of
$\Spacesstack'_{fp, flat, proper}$ over $T_i$.
Assume that $T \times_{T_i} X_i \to T$ has
relative dimension $\leq 1$.
Then for some $i' \geq i$ the morphism
$T_{i'} \times_{T_i} X_i \to T_i$ has
relative dimension $\leq 1$. This follows from
Limits of Spaces, Lemma
\ref{spaces-limits-lemma-eventually-relative-dimension}.
\end{proof}

\begin{lemma}
\label{lemma-curves-RS-star}
Let
$$
\xymatrix{
T \ar[r] \ar[d] & T' \ar[d] \\
S \ar[r] & S'
}
$$
be a pushout in the category of schemes where
$T \to T'$ is a thickening and $T \to S$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the functor on fibre categories
$$
\Curvesstack_{S'}
\longrightarrow
\Curvesstack_S
\times_{\Curvesstack_T}
\Curvesstack_{T'}
$$
is an equivalence.
\end{lemma}

\begin{proof}
Using the embedding (\ref{equation-curves-over-proper-spaces}),
the description of the image, and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-RS-star})
this reduces to the following statement:
given a morphism $X' \to S'$ of an algebraic space to $S'$
which is of finite presentation, flat, proper then
$X' \to S'$ has relative dimension $\leq 1$
if and only if $S \times_{S'} X' \to S$
and $T' \times_{S'} X' \to T'$ have relative dimension $\leq 1$.
One implication follows from the fact that
having relative dimension $\leq 1$ is preserved under base change
(Morphisms of Spaces, Lemma
\ref{spaces-morphisms-lemma-dimension-fibre-after-base-change}).
The other follows from the fact that having relative
dimension $\leq 1$ is checked on the fibres and that
the fibres of $X' \to S'$ (over points of the scheme $S'$)
are the same as the fibres of $S \times_{S'} X' \to S$
since $S \to S'$ is a thickening by
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
\end{proof}

\begin{lemma}
\label{lemma-curves-tangent-space}
Let $k$ be a field and let $x = (X \to \Spec(k))$ be an object of
$\mathcal{X} = \Curvesstack$ over $\Spec(k)$.
\begin{enumerate}
\item If $k$ is of finite type over $\mathbf{Z}$, then
the vector spaces $T\mathcal{F}_{\mathcal{X}, k, x}$ and
$\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x})$
(see Artin's Axioms, Section \ref{artin-section-tangent-spaces})
are finite dimensional, and
\item in general the vector spaces $T_x(k)$ and $\text{Inf}_x(k)$
(see Artin's Axioms, Section \ref{artin-section-inf})
are finite dimensional.
\end{enumerate}
\end{lemma}

\begin{proof}
This is immediate from the fully faithful embedding
(\ref{equation-curves-over-proper-spaces}) and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-tangent-space}).
\end{proof}

\begin{lemma}
\label{lemma-curves-existence}
Consider the stack $\Curvesstack$ over the base
scheme $\Spec(\mathbf{Z})$. Then every formal object is effective.
\end{lemma}

\begin{proof}
For definitions of the notions in the lemma, please see
Artin's Axioms, Section \ref{artin-section-formal-objects}.
Let $(A, \mathfrak m, \kappa)$ be a Noetherian complete
local ring. Let $(X_n \to \Spec(A/\mathfrak m^n))$
be a formal object of $\Curvesstack$ over $A$.
By More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-formal-algebraic-space-proper-reldim-1}
there exists a projective morphism $X \to \Spec(A)$
and a compatible system of ismomorphisms
$X \times_{\Spec(A)} \Spec(A/\mathfrak m^n) \cong X_n$. By
More on Morphisms, Lemma
\ref{more-morphisms-lemma-check-flatness-on-infinitesimal-nbhds}
we see that $X \to \Spec(A)$ is flat. By More on Morphisms, Lemma
\ref{more-morphisms-lemma-dimension-fibres-proper-flat}
we see that $X \to \Spec(A)$ has relative dimension $\leq 1$.
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-curves-defo-thy}
The stack in groupoids $\mathcal{X} = \Curvesstack$
satisfies openness of versality over $\Spec(\mathbf{Z})$.
Similarly, after base change (Remark \ref{remark-curves-base-change})
openness of versality holds over any Noetherian base scheme $S$.
\end{lemma}

\begin{proof}
This is immediate from the fully faithful embedding
(\ref{equation-curves-over-proper-spaces}) and
the corresponding fact for $\Spacesstack'_{fp, flat, proper}$
(Lemma \ref{lemma-spaces-defo-thy}).
\end{proof}

\begin{theorem}[Algebraicity of the stack of curves]
\label{theorem-curves-algebraic}
\begin{reference}
See \cite[Proposition 3.3, page 8]{dJHS} and
\cite[Appendix B by Jack Hall, Theorem B.1]{Smyth}.
\end{reference}
The stack $\Curvesstack$ (Situation \ref{situation-curves})
is algebraic. In fact, for any algebraic space $B$ the stack
$B\text{-}\Curvesstack$ (Remark \ref{remark-curves-base-change})
is algebraic.
\end{theorem}

\begin{proof}
The absolute case follows from
Artin's Axioms, Lemma \ref{artin-lemma-diagonal-representable}
and Lemmas \ref{lemma-curves-diagonal},
\ref{lemma-curves-RS-star},
\ref{lemma-curves-limits},
\ref{lemma-curves-existence}, and
\ref{lemma-curves-defo-thy}.
The case over $B$ follows from this, the description of
$B\text{-}\Curvesstack$ as a $2$-fibre product in
Remark \ref{remark-curves-base-change}, and the fact
that algebraic stacks have $2$-fibre products, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-2-fibre-product}.
\end{proof}

\begin{lemma}
\label{lemma-curves-open-and-closed-in-spaces}
The $1$-morphism (\ref{equation-curves-over-proper-spaces})
$$
\Curvesstack \longrightarrow \Spacesstack'_{fp, flat, proper}
$$
is representable by open and closed immersions.
\end{lemma}

\begin{proof}
Since (\ref{equation-curves-over-proper-spaces}) is a fully faithful
embedding of categories it suffices to show the following:
given an object $X \to S$ of $\Spacesstack'_{fp, flat, proper}$
there exists an open and closed subscheme $U \subset S$
such that a morphism $S' \to S$ factors through $U$ if and only if the
base change $X' \to S'$ of $X \to S$ has relative dimension $\leq 1$.
This follows immediately from
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-dimension-fibres-proper-flat}.
\end{proof}

\begin{remark}
\label{remark-alternative-approach-curves}
Consider the $2$-fibre product
$$
\xymatrix{
\Curvesstack \times_{\Spacesstack'_{fp, flat, proper}}
\Polarizedstack \ar[r] \ar[d] &
\Polarizedstack \ar[d] \\
\Curvesstack \ar[r] &
\Spacesstack'_{fp, flat, proper}
}
$$
This fibre product parametrized polarized curves, i.e., families
of curves endowed with a relatively ample invertible sheaf.
It turns out that the left vertical arrow
$$
\textit{PolarizedCurves} \longrightarrow \Curvesstack
$$
is algebraic, smooth, and surjective. Namely, this $1$-morphism
is algebraic (as base change of the arrow in
Lemma \ref{lemma-polarized-to-spaces-algebraic}),
every point is in the image, and
there are no obstructions to deforming invertible sheaves on curves
(see proof of Lemma \ref{lemma-curves-existence}).
This gives another approach to the algebraicity of $\Curvesstack$.
Namely, by Lemma \ref{lemma-curves-open-and-closed-in-spaces}
we see that $\textit{PolarizedCurves}$ is an open and closed substack
of the algebraic stack $\Polarizedstack$ and any stack in groupoids
which is the target of a smooth algebraic morphism from an algebraic
stack is an algebraic stack.
\end{remark}









\section{Moduli of complexes on a proper morphism}
\label{section-moduli-complexes}

\noindent
The title and the material of this section are taken from
\cite{lieblich-complexes}. Let $S$ be a scheme and let
$f : X \to B$ be a proper, flat, finitely presented morphism
of algebraic spaces. We will prove that there is an
algebraic stack
$$
\Complexesstack_{X/B}
$$
parametrizing ``families'' of objects of $D^b_{\textit{Coh}}$
of the fibres with vanishing negative self-exts. More precisely
a family is given by a relatively perfect object of the derived
category of the total space; this somewhat technical notion
is studied in
More on Morphisms of Spaces, Section
\ref{spaces-more-morphisms-section-relatively-perfect}.

\medskip\noindent
Already if $X$ is a proper algebraic
space over a field $k$ we obtain a very interesting algebraic stack.
Namely, there is an embedding
$$
\Cohstack_{X/k} \longrightarrow \Complexesstack_{X/k}
$$
since for any $\mathcal{O}$-module $\mathcal{F}$ (on any ringed topos)
we have $\Ext^i_\mathcal{O}(\mathcal{F}, \mathcal{F}) = 0$ for $i < 0$.
Although this certainly shows our stack is nonempty, the
true motivation for the study of $\Complexesstack_{X/k}$
is that there are often objects of the derived category
$D^b_{\textit{Coh}}(\mathcal{O}_X)$ with vanishing negative self-exts
and nonvanishing cohomology sheaves in more than one degree.
For example, $X$ could be derived equivalent to another
proper algebraic space $Y$ over $k$, i.e., we have a
$k$-linear equivalence
$$
F : D^b_{\textit{Coh}}(\mathcal{O}_Y)
\longrightarrow
D^b_{\textit{Coh}}(\mathcal{O}_X)
$$
There are cases where this happens and $F$ is not given by
an automorphism between $X$ and $Y$; for example in the case
of an abelian variety and its dual. In this situation $F$ induces
an isomorphism of algebraic stacks
$$
\Complexesstack_{Y/k}
\longrightarrow
\Complexesstack_{X/k}
$$
(insert future reference here) and in particular the stack of coherent sheaves
on $Y$ maps into the stack of complexes on $X$. Turning this around,
if we can understand well enough the geometry of
$\Complexesstack_{X/k}$, then we can try to use this to study all possible
derived equivalent $Y$.

\begin{lemma}
\label{lemma-complexes-open-neg-exts-vanishing}
Let $S$ be a scheme.
Let $f : X \to Y$ be a morphism of algebraic spaces over $S$.
Assume $f$ is proper, flat, and of finite presentation.
Let $K, E \in D(\mathcal{O}_X)$. Assume $K$ is pseudo-coherent
and $E$ is $Y$-perfect (More on Morphisms of Spaces, Definition
\ref{spaces-more-morphisms-definition-relatively-perfect}).
For a field $k$ and a morphism $y : \Spec(k) \to Y$ denote $K_y$, $E_y$
the pullback to the fibre $X_y$.
\begin{enumerate}
\item There is an open $W \subset Y$ characterized by the property
$$
y \in |W|
\Leftrightarrow
\Ext^i_{\mathcal{O}_{X_y}}(K_y, E_y) = 0
\text{ for }i < 0.
$$
\item For any morphism $V \to Y$ factoring through $W$ we have
$$
\Ext^i_{\mathcal{O}_{X_V}}(K_V, E_V) = 0
\quad\text{for}\quad i < 0
$$
where $X_V$ is the base change of $X$ and $K_V$ and $E_V$
are the derived pullbacks of $K$ and $E$ to $X_V$.
\item The functor $V \mapsto \Hom_{\mathcal{O}_{X_V}}(K_V, E_V)$
is a sheaf on $(\textit{Spaces}/W)_{fppf}$ representable by an
algebraic space affine and of finite presentation over $W$.
\end{enumerate}
\end{lemma}

\begin{proof}
For any morphism $V \to Y$ the complex $K_V$ is pseudo-coherent
(Cohomology on Sites, Lemma
\ref{sites-cohomology-lemma-pseudo-coherent-pullback})
and $E_V$ is $V$-perfect (More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-base-change-relatively-perfect}).
Another observation is that given $y : \Spec(k) \to Y$
and a field extension $k'/k$ with $y' : \Spec(k') \to Y$
the induced morphism, we have
$$
\Ext^i_{\mathcal{O}_{X_{y'}}}(K_{y'}, E_{y'}) =
\Ext^i_{\mathcal{O}_{X_y}}(K_y, E_y) \otimes_k k'
$$
by Derived Categories of Schemes, Lemma
\ref{perfect-lemma-affine-morphism-and-hom-out-of-perfect}.
Thus the vanishing in (1) is really a property of the induced
point $y \in |Y|$.
We will use these two observations without further mention in the proof.

\medskip\noindent
Assume first $Y$ is an affine scheme. Then we may apply
More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-compute-ext-rel-perfect}
and find a pseudo-coherent $L \in D(\mathcal{O}_Y)$ which
``universally computes'' $Rf_*R\SheafHom(K, E)$ in the sense
described in that lemma. Unwinding the definitions, we obtain
for a point $y \in Y$ the equality
$$
\Ext^i_{\kappa(y)}(L \otimes_{\mathcal{O}_Y}^\mathbf{L} \kappa(y),
\kappa(y)) = \Ext^i_{\mathcal{O}_{X_y}}(K_y, E_y)
$$
We conclude that
$$
H^i(L \otimes_{\mathcal{O}_Y}^\mathbf{L} \kappa(y)) = 0
\text{ for } i > 0 \Leftrightarrow
\Ext^i_{\mathcal{O}_{X_y}}(K_y, E_y) = 0 \text{ for }i < 0.
$$
By Derived Categories of Schemes, Lemma \ref{perfect-lemma-jump-loci}
the set $W$ of $y \in Y$ where this happens defines an open of $Y$.
This open $W$ then satisfies the requirement in (1) for all morphisms
from spectra of fields, by the ``universality'' of $L$.

\medskip\noindent
Let's go back to $Y$ a general algebraic space.
Choose an \'etale covering $\{V_i \to Y\}$ by affine schemes $V_i$.
Then we see that the subset $W \subset |Y|$ pulls back to the corresponding
subset $W_i \subset |V_i|$ for $X_{V_i}$, $K_{V_i}$, $E_{V_i}$.
By the previous paragraph we find that $W_i$ is open, hence $W$ is open.
This proves (1) in general. Moreover, parts (2) and (3) are entirely formulated
in terms of the category $\textit{Spaces}/W$ and the restrictions
$X_W$, $K_W$, $E_W$. This reduces us to the case $W = Y$.

\medskip\noindent
Assume $W = Y$. We claim that for any algebraic space $V$ over $Y$
we have $Rf_{V, *}R\SheafHom(K_V, E_V)$ has vanishing cohomology
sheaves in degrees $< 0$. This will prove (2) because
$$
\Ext^i_{\mathcal{O}_{X_V}}(K_V, E_V) =
H^i(X_V, R\SheafHom(K_V, E_V)) = 
H^i(V, Rf_{V, *}R\SheafHom(K_V, E_V))
$$
by Cohomology on Sites, Lemmas
\ref{sites-cohomology-lemma-section-RHom-over-U} and
\ref{sites-cohomology-lemma-Leray-unbounded}
and the vanishing of the cohomology sheaves implies the
cohomology group $H^i$ is zero for $i < 0$ by
Derived Categories, Lemma \ref{derived-lemma-negative-vanishing}.

\medskip\noindent
To prove the claim, we may work \'etale locally on $V$.
In particular, we may assume $Y$ is affine and $W = Y$.
Let $L \in D(\mathcal{O}_Y)$ be as in the second paragraph of the proof.
For an algebraic space $V$ over $Y$ denote $L_V$ the derived pullback of
$L$ to $V$. (An important feature we will use is that $L$ ``works'' for all
algebraic spaces $V$ over $Y$ and not just affine $V$.)
As $W = Y$ we have $H^i(L) = 0$ for $i > 0$
(use More on Algebra, Lemma
\ref{more-algebra-lemma-lift-pseudo-coherent-from-residue-field}
to go from fibres to stalks). Hence $H^i(L_V) = 0$ for $i > 0$.
The property defining $L$ is that
$$
Rf_{V, *}R\SheafHom(K_V, E_V) = R\SheafHom(L_V, \mathcal{O}_V)
$$
Since $L_V$ sits in degrees $\leq 0$, we conclude that
$R\SheafHom(L_V, \mathcal{O}_V)$ sits in degrees $\geq 0$
thereby proving the claim. This finishes the proof of (2).

\medskip\noindent
Assume $W = Y$ but make no assumptions on the algebraic space $Y$.
Since we have (2), we see from
Simplicial Spaces, Lemma \ref{spaces-simplicial-lemma-fppf-neg-ext-zero-hom}
that the functor $F$ given by $F(V) = \Hom_{\mathcal{O}_{X_V}}(K_V, E_V)$
is a sheaf\footnote{To check the sheaf property
for a covering $\{V_i \to V\}_{i \in I}$ first consider the
{\v C}ech fppf hypercovering $a : V_\bullet \to V$ with
$V_n = \coprod_{i_0 \ldots i_n} V_{i_0} \times_V \ldots \times_V V_{i_n}$
and then set $U_\bullet = V_\bullet \times_{a, V} X_V$. Then
$U_\bullet \to X_V$ is an fppf hypercovering to which we may
apply Simplicial Spaces, Lemma
\ref{spaces-simplicial-lemma-fppf-neg-ext-zero-hom}.}
on $(\textit{Spaces}/Y)_{fppf}$. Thus to prove that $F$
is an algebraic space and that $F \to Y$ is affine and of
finite presentation, we may work \'etale locally on $Y$; see
Bootstrap, Lemma \ref{bootstrap-lemma-locally-algebraic-space-finite-type}
and
Morphisms of Spaces, Lemmas \ref{spaces-morphisms-lemma-affine-local} and
\ref{spaces-morphisms-lemma-finite-presentation-local}. We conclude
that it suffices to prove $F$ is an affine algebraic space of
finite presentation over $Y$ when $Y$ is an affine scheme. In this
case we go back to our pseudo-coherent complex $L \in D(\mathcal{O}_Y)$.
Since $H^i(L) = 0$ for $i > 0$, we can represent $L$ by a complex
of the form
$$
\ldots \to \mathcal{O}_Y^{\oplus m_1} \to \mathcal{O}_Y^{\oplus m_0}
\to 0 \to \ldots
$$
with the last term in degree $0$, see More on Algebra, Lemma
\ref{more-algebra-lemma-pseudo-coherent}. Combining the two displayed formulas
earlier in the proof we find that
$$
F(V) =
\Ker(
\Hom_V(\mathcal{O}_V^{\oplus m_0}, \mathcal{O}_V)
\to 
\Hom_V(\mathcal{O}_V^{\oplus m_1}, \mathcal{O}_V)
)
$$
In other words, there is a fibre product diagram
$$
\xymatrix{
F \ar[d] \ar[r] & Y \ar[d]^0 \\
\mathbf{A}_Y^{m_0} \ar[r] & \mathbf{A}_Y^{m_1}
}
$$
which proves what we want.
\end{proof}

\begin{lemma}
\label{lemma-complexes}
Let $S$ be a scheme. Let $f : X \to Y$ be a morphism of algebraic
spaces over $S$. Assume $f$ is proper, flat, and of finite presentation.
Let $E \in D(\mathcal{O}_X)$.
Assume
\begin{enumerate}
\item $E$ is $S$-perfect (More on Morphisms of Spaces, Definition
\ref{spaces-more-morphisms-definition-relatively-perfect}), and
\item for every point $s \in S$ we have
$$
\Ext^i_{\mathcal{O}_{X_s}}(E_s, E_s) = 0
\quad\text{for}\quad i < 0
$$
where $E_s$ is the pullback to the fibre $X_s$.
\end{enumerate}
Then
\begin{enumerate}
\item[(a)] (1) and (2) are preserved by arbitrary base change $V \to Y$,
\item[(b)] $\Ext^i_{\mathcal{O}_{X_V}}(E_V, E_V) = 0$ for $i < 0$
and all $V$ over $Y$,
\item[(c)] $V \mapsto \Hom_{\mathcal{O}_{X_V}}(E_V, E_V)$ is representable
by an algebraic space affine and of finite presentation over $Y$.
\end{enumerate}
Here $X_V$ is the base change of $X$ and $E_V$ is the derived pullback
of $E$ to $X_V$.
\end{lemma}

\begin{proof}
Immediate consequence of Lemma \ref{lemma-complexes-open-neg-exts-vanishing}.
\end{proof}

\begin{situation}
\label{situation-complexes}
Let $S$ be a scheme. Let $f : X \to B$ be a morphism of algebraic spaces
over $S$. Assume $f$ is proper, flat, and of finite presentation.
We denote $\Complexesstack_{X/B}$ the category whose objects are
triples $(T, g, E)$ where
\begin{enumerate}
\item $T$ is a scheme over $S$,
\item $g : T \to B$ is a morphism over $S$, and setting
$X_T = T \times_{g, B} X$
\item $E$ is an object of $D(\mathcal{O}_{X_T})$ satisfying
conditions (1) and (2) of Lemma \ref{lemma-complexes}.
\end{enumerate}
A morphism $(T, g, E) \to (T', g', E')$
is given by a pair $(h, \varphi)$ where
\begin{enumerate}
\item $h : T \to T'$ is a morphism of schemes over $B$
(i.e., $g' \circ h = g$), and
\item $\varphi : L(h')^*E' \to E$ is an
isomorphism of $D(\mathcal{O}_{X_T})$ where $h' : X_T \to X_{T'}$
is the base change of $h$.
\end{enumerate}
\end{situation}

\noindent
Thus $\Complexesstack_{X/B}$ is a category and the rule
$$
p : \Complexesstack_{X/B} \longrightarrow (\Sch/S)_{fppf},
\quad
(T, g, E) \longmapsto T
$$
is a functor. For a scheme $T$ over $S$ we denote $\Complexesstack_{X/B, T}$
the fibre category of $p$ over $T$. These fibre categories are groupoids.

\begin{lemma}
\label{lemma-complexes-fibred-in-groupoids}
In Situation \ref{situation-complexes} the functor
$p : \Complexesstack_{X/B} \longrightarrow (\Sch/S)_{fppf}$
is fibred in groupoids.
\end{lemma}

\begin{proof}
We show that $p$ is fibred in groupoids by checking conditions
(1) and (2) of Categories, Definition
\ref{categories-definition-fibred-groupoids}.
Given an object $(T', g', E')$
of $\Complexesstack_{X/B}$ and a morphism $h : T \to T'$ of
schemes over $S$ we can set $g = h \circ g'$ and
$E = L(h')^*E'$ where $h' : X_T \to X_{T'}$
is the base change of $h$. Then it is clear that we obtain
a morphism $(T, g, E) \to (T', g', E')$
of $\Complexesstack_{X/B}$ lying over $h$. This proves (1).
For (2) suppose we are given morphisms
$$
(h_1, \varphi_1) : (T_1, g_1, E_1) \to (T, g, E)
\quad\text{and}\quad
(h_2, \varphi_2) : (T_2, g_2, E_2) \to (T, g, E)
$$
of $\Complexesstack_{X/B}$ and a morphism $h : T_1 \to T_2$ such that
$h_2 \circ h = h_1$. Then we can let $\varphi$ be the composition
$$
L(h')^*E_2
\xrightarrow{L(h')^*\varphi_2^{-1}}
L(h')^*L(h_2)^*E = L(h_1)^*E
\xrightarrow{\varphi_1}
E_1
$$
to obtain the morphism
$(h, \varphi) : (T_1, g_1, E_1) \to (T_2, g_2, E_2)$
that witnesses the truth of condition (2).
\end{proof}

\begin{lemma}
\label{lemma-complexes-diagonal}
In Situation \ref{situation-complexes}. Denote
$\mathcal{X} = \Complexesstack_{X/B}$. Then
$\Delta : \mathcal{X} \to \mathcal{X} \times \mathcal{X}$ is
representable by algebraic spaces.
\end{lemma}

\begin{proof}
Consider two objects $x = (T, g, E)$ and $y = (T, g', E')$
of $\mathcal{X}$ over a scheme $T$. We have to show that
$\mathit{Isom}_\mathcal{X}(x, y)$ is an algebraic space over $T$, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-representable-diagonal}.
If for $h : T' \to T$ the restrictions $x|_{T'}$ and $y|_{T'}$ are isomorphic
in the fibre category $\mathcal{X}_{T'}$, then $g \circ h = g' \circ h$.
Hence there is a transformation of presheaves
$$
\mathit{Isom}_\mathcal{X}(x, y) \longrightarrow \text{Equalizer}(g, g')
$$
Since the diagonal of $B$ is representable (by schemes) this equalizer is
a scheme. Thus we may replace $T$ by this equalizer and
$E$ and $E'$ by their pullbacks. Thus we may assume $g = g'$.

\medskip\noindent
Assume $g = g'$. After replacing $B$ by $T$ and $X$ by $X_T$ we arrive
at the following problem. Given $E, E' \in D(\mathcal{O}_X)$
satisfying conditions (1), (2) of Lemma \ref{lemma-complexes}
we have to show that $\mathit{Isom}(E, E')$ is an algebraic space.
Here $\mathit{Isom}(E, E')$ is the functor
$$
(\Sch/B)^{opp} \to \textit{Sets},\quad
T \mapsto \{\varphi : E_T \to E'_T
\text{ isomorphism in }D(\mathcal{O}_{X_T})\}
$$
where $E_T$ and $E'_T$ are the derived pullbacks of $E$ and $E'$
to $X_T$. Now, let $W \subset B$, resp.\ $W' \subset B$ be the
open subspace of $B$ associated
to $E, E'$, resp.\ to $E', E$ by
Lemma \ref{lemma-complexes-open-neg-exts-vanishing}.
Clearly, if there exists an isomorphism $E_T \to E'_T$ as in
the definition of $\mathit{Isom}(E, E')$, then we see that
$T \to B$ factors into both $W$ and $W'$ (because we have
condition (1) for $E$ and $E'$ and we'll obviously have
$E_t \cong E'_t$ so no nonzero maps $E_t[i] \to E_t$
or $E'_t[i] \to E_t$ over the fibre $X_t$ for $i > 0$.
Thus we may replace $B$ by the open $W \cap W'$.
In this case the functor $H = \SheafHom(E, E')$
$$
(\Sch/B)^{opp} \to \textit{Sets},\quad T \mapsto
\Hom_{\mathcal{O}_{X_T}}(E_T, E'_T)
$$
is an algebraic space affine and of finite presentation over $B$ by
Lemma \ref{lemma-complexes-open-neg-exts-vanishing}.
The same is true for
$H' = \SheafHom(E', E)$,
$I = \SheafHom(E, E)$, and
$I' = \SheafHom(E', E')$.
Therefore we can repeat the argument of the proof of
Proposition \ref{proposition-isom} to see that
$$
\mathit{Isom}(E, E') = (H' \times_B H) \times_{c, I \times_B I', \sigma} B
$$
for some morphisms $c$ and $\sigma$. Thus
$\mathit{Isom}(E, E')$ is an algebraic space.
\end{proof}

\begin{lemma}
\label{lemma-complexes-stack}
In Situation \ref{situation-complexes} the functor
$p : \Complexesstack_{X/B} \longrightarrow (\Sch/S)_{fppf}$
is a stack in groupoids.
\end{lemma}

\begin{proof}
To prove that $\Complexesstack_{X/B}$ is a stack in groupoids,
we have to show that the presheaves $\mathit{Isom}$ are sheaves
and that descent data are effective. The statement on
$\mathit{Isom}$ follows from Lemma \ref{lemma-complexes-diagonal}, see
Algebraic Stacks, Lemma \ref{algebraic-lemma-representable-diagonal}.
Let us prove the statement on descent data.

\medskip\noindent
Suppose that $\{a_i : T_i \to T\}$ is an fppf covering of schemes over $S$.
Let $(\xi_i, \varphi_{ij})$ be a descent datum for $\{T_i \to T\}$
with values in $\Complexesstack_{X/B}$.
For each $i$ we can write $\xi_i = (T_i, g_i, E_i)$.
Denote $\text{pr}_0 : T_i \times_T T_j \to T_i$ and
$\text{pr}_1 : T_i \times_T T_j \to T_j$ the projections.
The condition that $\xi_i|_{T_i \times_T T_j} \cong \xi_j|_{T_i \times_T T_j}$
implies in particular that $g_i \circ \text{pr}_0 = g_j \circ \text{pr}_1$.
Thus there exists a unique morphism $g : T \to B$ such that
$g_i = g \circ a_i$, see
Descent on Spaces, Lemma
\ref{spaces-descent-lemma-fpqc-universal-effective-epimorphisms}.
Denote $X_T = T \times_{g, B} X$. Set
$X_i = X_{T_i} = T_i \times_{g_i, B} X = T_i \times_{a_i, T} X_T$
and
$$
X_{ij} = X_{T_i} \times_{X_T} X_{T_j} = X_i \times_{X_T} X_j
$$
with projections $\text{pr}_i$ and $\text{pr}_j$ to $X_i$ and $X_j$.
Observe that the pullback of $(T_i, g_i, E_i)$
by $\text{pr}_0 : T_i \times_T T_j \to T_i$ is given by
$(T_i \times_T T_j, g_i \circ \text{pr}_0, L\text{pr}_i^*E_i)$.
Hence a descent datum for $\{T_i \to T\}$ in $\Complexesstack_{X/B}$
is given by the objects $(T_i, g \circ a_i, E_i)$
and for each pair $i, j$ an isomorphism in
$D\mathcal{O}_{X_{ij}})$
$$
\varphi_{ij} :
L\text{pr}_i^*E_i \longrightarrow L\text{pr}_j^*E_j
$$
satisfying the cocycle condition over the pullback of $X$ to
$T_i \times_T T_j \times_T T_k$.
Using the vanishing of negative Exts provided by (b) of
Lemma \ref{lemma-complexes}, we may apply
Simplicial Spaces, Lemma \ref{spaces-simplicial-lemma-fppf-glue-neg-ext-zero}
to obtain descent\footnote{To check this, first consider the
{\v C}ech fppf hypercovering $a : T_\bullet \to T$ with
$T_n = \coprod_{i_0 \ldots i_n} T_{i_0} \times_T \ldots \times_T T_{i_n}$
and then set $U_\bullet = T_\bullet \times_{a, T} X_T$. Then
$U_\bullet \to X_T$ is an fppf hypercovering to which we may
apply Simplicial Spaces, Lemma
\ref{spaces-simplicial-lemma-fppf-glue-neg-ext-zero}.}
for these complexes. In other words, we find there exists an object
$E$ in $D_\QCoh(\mathcal{O}_{X_T})$ restricting to $E_i$ on $X_{T_i}$
compatible with $\varphi_{ij}$. Recall that being
$T$-perfect signifies being pseudo-coherent and having
locally finite tor dimension over $f^{-1}\mathcal{O}_T$.
Thus $E$ is $T$-perfect by an application of
More on Morphisms of Spaces, Lemmas
\ref{spaces-more-morphisms-lemma-pseudo-coherent-descends-fpqc} and
\ref{spaces-more-morphisms-lemma-tor-amplitude-descends-fppf}.
Finally, we have to check condition (2) from
Lemma \ref{lemma-complexes} for $E$.
This immediately follows from the description of the open $W$
in Lemma \ref{lemma-complexes-open-neg-exts-vanishing}
and the fact that (2) holds for $E_i$ on $X_{T_i}/T_i$.
\end{proof}

\begin{remark}
\label{remark-complexes-base-change}
In Situation \ref{situation-complexes} the rule
$(T, g, E) \mapsto (T, g)$ defines a $1$-morphism
$$
\Complexesstack_{X/B} \longrightarrow \mathcal{S}_B
$$
of stacks in groupoids
(see Lemma \ref{lemma-complexes-stack},
Algebraic Stacks, Section \ref{algebraic-section-split}, and
Examples of Stacks, Section
\ref{examples-stacks-section-stack-associated-to-sheaf}).
Let $B' \to B$ be a morphism of
algebraic spaces over $S$. Let $\mathcal{S}_{B'} \to \mathcal{S}_B$
be the associated $1$-morphism of stacks fibred in sets.
Set $X' = X \times_B B'$.
We obtain a stack in groupoids
$\Complexesstack_{X'/B'} \to (\Sch/S)_{fppf}$
associated to the base change $f' : X' \to B'$. In this situation
the diagram
$$
\vcenter{
\xymatrix{
\Complexesstack_{X'/B'} \ar[r] \ar[d] &
\Complexesstack_{X/B} \ar[d] \\
\mathcal{S}_{B'} \ar[r] & \mathcal{S}_B
}
}
\quad
\begin{matrix}
\text{or in} \\
\text{another} \\
\text{notation}
\end{matrix}
\quad
\vcenter{
\xymatrix{
\Complexesstack_{X'/B'} \ar[r] \ar[d] &
\Complexesstack_{X/B} \ar[d] \\
\Sch/B' \ar[r] & \Sch/B
}
}
$$
is $2$-fibre product square. This trivial remark
will occasionally be useful to change the base algebraic space.
\end{remark}

\begin{lemma}
\label{lemma-complexes-limits}
In Situation \ref{situation-complexes} assume that $B \to S$
is locally of finite presentation. Then
$p : \Complexesstack_{X/B} \to (\Sch/S)_{fppf}$ is limit preserving
(Artin's Axioms, Definition \ref{artin-definition-limit-preserving}).
\end{lemma}

\begin{proof}
Write $B(T)$ for the discrete category whose
objects are the $S$-morphisms $T \to B$. Let $T = \lim T_i$ be a filtered
limit of affine schemes over $S$. Assigning to an object
$(T, h, E)$ of $\Complexesstack_{X/B, T}$ the object $h$
of $B(T)$ gives us a commutative diagram of fibre categories
$$
\xymatrix{
\colim \Complexesstack_{X/B, T_i} \ar[r] \ar[d] &
\Complexesstack_{X/B, T} \ar[d] \\
\colim B(T_i) \ar[r] & B(T)
}
$$
We have to show the top horizontal arrow is an equivalence. Since
we have assume that $B$ is locally of finite presentation over $S$
we see from
Limits of Spaces, Remark \ref{spaces-limits-remark-limit-preserving}
that the bottom horizontal arrow is an equivalence. This means that
we may assume $T = \lim T_i$ be a filtered limit of affine schemes over
$B$. Denote $g_i : T_i \to B$ and $g : T \to B$ the corresponding
morphisms. Set $X_i = T_i \times_{g_i, B} X$ and $X_T = T \times_{g, B} X$.
Observe that $X_T = \colim X_i$.
By More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-descend-relatively-perfect}
the category of $T$-perfect objects of $D(\mathcal{O}_{X_T})$
is the colimit of the categories of $T_i$-perfect objects
of $D(\mathcal{O}_{X_{T_i}})$.
Thus all we have to prove is that given an $T_i$-perfect object
$E_i$ of $D(\mathcal{O}_{X_{T_i}})$ such that
the derived pullback $E$ of $E_i$ to $X_T$ satisfies
condition (2) of Lemma \ref{lemma-complexes},
then after increasing $i$ we have that
$E_i$ satisfies
condition (2) of Lemma \ref{lemma-complexes}.
Let $W \subset |T_i|$ be the open constructed
in Lemma \ref{lemma-complexes-open-neg-exts-vanishing}
for $E_i$ and $E_i$. By assumption on $E$ we find
that $T \to T_i$ factors through $T$.
Hence there is an $i' \geq i$
such that $T_{i'} \to T_i$ factors through $W$, see
Limits, Lemma \ref{limits-lemma-limit-contained-in-constructible}
Then $i'$ works by construction of $W$.
\end{proof}

\begin{lemma}
\label{lemma-complexes-RS-star}
In Situation \ref{situation-complexes}. Let
$$
\xymatrix{
Z \ar[r] \ar[d] & Z' \ar[d] \\
Y \ar[r] & Y'
}
$$
be a pushout in the category of schemes over $S$ where
$Z \to Z'$ is a finite order thickening and $Z \to Y$ is affine, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-pushout-along-thickening}.
Then the functor on fibre categories
$$
\Complexesstack_{X/B, Y'}
\longrightarrow
\Complexesstack_{X/B, Y}
\times_{\Complexesstack_{X/B, Z}}
\Complexesstack_{X/B, Z'}
$$
is an equivalence.
\end{lemma}

\begin{proof}
Observe that the corresponding map
$$
B(Y') \longrightarrow B(Y) \times_{B(Z)} B(Z')
$$
is a bijection, see Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-pushout-along-thickening-schemes}.
Thus using the commutative diagram
$$
\xymatrix{
\Complexesstack_{X/B, Y'} \ar[r] \ar[d] &
\Complexesstack_{X/B, Y}
\times_{\Complexesstack_{X/B, Z}}
\Complexesstack_{X/B, Z'}
\ar[d] \\
B(Y') \ar[r] & B(Y) \times_{B(Z)} B(Z')
}
$$
we see that we may assume that $Y'$ is a scheme over $B'$. By
Remark \ref{remark-complexes-base-change}
we may replace $B$ by $Y'$ and $X$ by $X \times_B Y'$.
Thus we may assume $B = Y'$.

\medskip\noindent
Assume $B = Y'$. We first prove fully faithfulness of our functor.
To do this, let $\xi_1, \xi_2$ be two objects of $\Complexesstack_{X/B}$
over $Y'$. Then we have to show that
$$
\mathit{Isom}(\xi_1, \xi_2)(Y') \longrightarrow
\mathit{Isom}(\xi_1, \xi_2)(Y)
\times_{\mathit{Isom}(\xi_1, \xi_2)(Z)}
\mathit{Isom}(\xi_1, \xi_2)(Z')
$$
is bijective. However, we already know that $\mathit{Isom}(\xi_1, \xi_2)$
is an algebraic space over $B = Y'$. Thus this bijectivity follows from
Artin's Axioms, Lemma \ref{artin-lemma-pushout} (or the aforementioned
Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-pushout-along-thickening-schemes}).

\medskip\noindent
Essential surjectivity. Let $(E_Y, E_{Z'}, \alpha)$ be a triple,
where $E_Y \in D(\mathcal{O}_Y)$ and $E_{Z'} \in D(\mathcal{O}_{X_{Z'}})$
are objects such that $(Y, Y \to B, E_Y)$ is an object of
$\Complexesstack_{X/B}$ over $Y$, such that
$(Z', Z' \to B, E_{Z'})$ is an object of $\Complexesstack_{X/B}$ over $Z'$,
and $\alpha : L(X_Z \to X_Y)^*E_Y \to L(X_Z \to X_{Z'})^*E_{Z'}$
is an isomorphism in $D(\mathcal{O}_{Z'})$.
That is to say
$$
((Y, Y \to B, E_Y), (Z', Z' \to B, E_{Z'}), \alpha)
$$
is an object of the target of the arrow of our lemma.
Observe that the diagram
$$
\xymatrix{
X_Z \ar[r] \ar[d] & X_{Z'} \ar[d] \\
X_Y \ar[r] & X_{Y'}
}
$$
is a pushout with $X_Z \to X_Y$ affine and $X_Z \to X_{Z'}$ a thickening
(see Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-equivalence-categories-spaces-pushout-flat}).
Hence by Pushouts of Spaces, Lemma
\ref{spaces-pushouts-lemma-pushout-along-thickening-derived}
we find an object $E_{Y'} \in D(\mathcal{O}_{X_{Y'}})$
together with isomorphisms
$L(X_Y \to X_{Y'})^*E_{Y'} \to E_Y$ and
$L(X_{Z'} \to X_{Y'})^*E_{Y'} \to E_Z$
compatible with $\alpha$. Clearly, if we show that
$E_{Y'}$ is $Y'$-perfect, then we are done, because property (2)
of Lemma \ref{lemma-complexes}
is a property on points (and $Y$ and $Y'$ have the same points).
This follows from More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-thickening-relatively-perfect}.
\end{proof}

\begin{lemma}
\label{lemma-complexes-tangent-space}
In Situation \ref{situation-complexes} assume that $S$ is a locally Noetherian
scheme and $B \to S$ is locally of finite presentation.
Let $k$ be a finite type field over $S$ and let
$x_0 = (\Spec(k), g_0, E_0)$
be an object of $\mathcal{X} = \Complexesstack_{X/B}$ over $k$.
Then the spaces $T\mathcal{F}_{\mathcal{X}, k, x_0}$ and
$\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x_0})$
(Artin's Axioms, Section \ref{artin-section-tangent-spaces})
are finite dimensional.
\end{lemma}

\begin{proof}
Observe that by Lemma \ref{lemma-complexes-RS-star}
our stack in groupoids $\mathcal{X}$ satisfies property (RS*)
defined in Artin's Axioms, Section \ref{artin-section-RS-star}.
In particular $\mathcal{X}$ satisfies (RS).
Hence all associated predeformation
categories are deformation categories
(Artin's Axioms, Lemma \ref{artin-lemma-deformation-category})
and the statement makes sense.

\medskip\noindent
In this paragraph we show that we can reduce to the case $B = \Spec(k)$.
Set $X_0 = \Spec(k) \times_{g_0, B} X$
and denote $\mathcal{X}_0 = \Complexesstack_{X_0/k}$. In
Remark \ref{remark-complexes-base-change} we have seen that
$\mathcal{X}_0$ is the $2$-fibre product of $\mathcal{X}$ with
$\Spec(k)$ over $B$ as categories fibred in groupoids over
$(\Sch/S)_{fppf}$. Thus by
Artin's Axioms, Lemma \ref{artin-lemma-fibre-product-tangent-spaces}
we reduce to proving that $B$, $\Spec(k)$, and $\mathcal{X}_0$
have finite dimensional tangent spaces and infinitesimal automorphism
spaces. The tangent space of $B$ and $\Spec(k)$ are finite dimensional by
Artin's Axioms, Lemma \ref{artin-lemma-finite-dimension}
and of course these have vanishing $\text{Inf}$.
Thus it suffices to deal with $\mathcal{X}_0$.

\medskip\noindent
Let $k[\epsilon]$ be the dual numbers over $k$.
Let $\Spec(k[\epsilon]) \to B$ be the composition of $g_0 : \Spec(k) \to B$
and the morphism $\Spec(k[\epsilon]) \to \Spec(k)$
coming from the inclusion $k \to k[\epsilon]$.
Set $X_0 = \Spec(k) \times_B X$ and
$X_\epsilon = \Spec(k[\epsilon]) \times_B X$.
Observe that $X_\epsilon$ is a first order thickening of $X_0$
flat over the first order thickening $\Spec(k) \to \Spec(k[\epsilon])$.
Observe that $X_0$ and $X_\epsilon$ give rise to canonically equivalent
small \'etale topoi, see
More on Morphisms of Spaces, Section
\ref{spaces-more-morphisms-section-thickenings}.
By More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-thickening-relatively-perfect}
we see that $T\mathcal{F}_{\mathcal{X}_0, k, x_0}$ is the set of
isomorphism classes of lifts of $E_0$ to $X_\epsilon$ in the sense of
Deformation Theory, Lemma \ref{defos-lemma-first-order-defos-complex}.
We conclude that
$$
T\mathcal{F}_{\mathcal{X}_0, k, x_0} =
\Ext^1_{\mathcal{O}_{X_0}}(E_0, E_0)
$$
Here we have used the identification $\epsilon k[\epsilon] \cong k$
of $k[\epsilon]$-modules. Using
Deformation Theory, Lemma \ref{defos-lemma-first-order-defos-complex}
once more we see that there is a surjection
$$
\text{Inf}(\mathcal{F}_{\mathcal{X}, k, x_0})
\leftarrow
\Ext^0_{\mathcal{O}_{X_0}}(E_0, E_0)
$$
of $k$-vector spaces. As $E_0$ is pseudo-coherent it lies in
$D^-_{\textit{Coh}}(\mathcal{O}_{X_0})$ by
Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-identify-pseudo-coherent-noetherian}.
Since $E_0$ locally has finite tor dimension and $X_0$
is quasi-compact we see $E_0 \in D^b_{\textit{Coh}}(\mathcal{O}_{X_0})$.
Thus the $\Ext$s above are finite dimensional $k$-vector spaces
by Derived Categories of Spaces, Lemma
\ref{spaces-perfect-lemma-ext-finite}.
\end{proof}

\begin{lemma}
\label{lemma-complexes-strong-effectiveness}
In Situation \ref{situation-complexes} assume $B = S$ is locally Noetherian.
Then strong formal effectiveness in the sense of
Artin's Axioms, Remark \ref{artin-remark-strong-effectiveness}
holds for $p : \Complexesstack_{X/S} \to (\Sch/S)_{fppf}$.
\end{lemma}

\begin{proof}
Let $(R_n)$ be an inverse system of $S$-algebras with surjective transition
maps whose kernels are locally nilpotent. Set $R = \lim R_n$.
Let $(\xi_n)$ be a system of objects of $\Complexesstack_{X/B}$
lying over $(\Spec(R_n))$. We have to show $(\xi_n)$ is effective, i.e.,
there exists an object $\xi$ of $\Complexesstack_{X/B}$ lying over
$\Spec(R)$.

\medskip\noindent
Write $X_R = \Spec(R) \times_S X$ and $X_n = \Spec(R_n) \times_S X$.
Of course $X_n$ is the base change of $X_R$ by $R \to R_n$. Since $S = B$,
we see that $\xi_n$ corresponds simply to an $R_n$-perfect object
$E_n \in D(\mathcal{O}_{X_n})$ satisfying condition (2) of
Lemma \ref{lemma-complexes}. In particular $E_n$ is pseudo-coherent.
The isomorphisms $\xi_{n + 1}|_{\Spec(R_n)} \cong \xi_n$
correspond to isomorphisms $L(X_n \to X_{n + 1})^*E_{n + 1} \to E_n$.
Therefore by
Flatness on Spaces, Theorem \ref{spaces-flat-theorem-existence-derived}
we find a pseudo-coherent object $E$ of $D(\mathcal{O}_{X_R})$
with $E_n$ equal to the derived pullback of $E$ for all $n$
compatible with the transition isomorphisms.

\medskip\noindent
Observe that $(R, \Ker(R \to R_1))$ is a henselian pair, see
More on Algebra, Lemma \ref{more-algebra-lemma-limit-henselian}.
In particular, $\Ker(R \to R_1)$ is contained in the Jacobson radical of $R$.
Then we may apply More on Morphisms of Spaces, Lemma
\ref{spaces-more-morphisms-lemma-henselian-relatively-perfect}
to see that $E$ is $R$-perfect.

\medskip\noindent
Finally, we have to check condition (2) of Lemma \ref{lemma-complexes}.
By Lemma \ref{lemma-complexes-open-neg-exts-vanishing}
the set of points $t$ of $\Spec(R)$ where the negative self-exts of $E_t$
vanish is an open. Since this condition is true in $V(\Ker(R \to R_1))$
and since $\Ker(R \to R_1)$ is contained in the Jacobson radical of $R$
we conclude it holds for all points.
\end{proof}

\begin{theorem}[Algebraicity of moduli of complexes on a proper morphism]
\label{theorem-complexes-algebraic}
\begin{reference}
\cite{lieblich-complexes}
\end{reference}
Let $S$ be a scheme. Let $f : X \to B$ be morphism of algebraic spaces
over $S$. Assume that $f$ is proper, flat, and of finite presentation.
Then $\Complexesstack_{X/B}$ is an algebraic stack over $S$.
\end{theorem}

\begin{proof}
Set $\mathcal{X} = \Complexesstack_{X/B}$. We have seen that $\mathcal{X}$
is a stack in groupoids over $(\Sch/S)_{fppf}$ with diagonal representable
by algebraic spaces
(Lemmas \ref{lemma-complexes-stack} and \ref{lemma-complexes-diagonal}).
Hence it suffices to find a scheme $W$ and a surjective and smooth
morphism $W \to \mathcal{X}$.

\medskip\noindent
Let $B'$ be a scheme and let $B' \to B$ be a surjective \'etale morphism.
Set $X' = B' \times_B X$ and denote $f' : X' \to B'$ the projection.
Then $\mathcal{X}' = \Complexesstack_{X'/B'}$ is equal to the $2$-fibre
product of $\mathcal{X}$ with the category fibred in sets
associated to $B'$ over the category fibred in sets associated to $B$
(Remark \ref{remark-complexes-base-change}). By the material in
Algebraic Stacks, Section \ref{algebraic-section-representable-properties}
the morphism $\mathcal{X}' \to \mathcal{X}$ is surjective and \'etale.
Hence it suffices to prove the result for $\mathcal{X}'$.
In other words, we may assume $B$ is a scheme.

\medskip\noindent
Assume $B$ is a scheme. In this case we may replace $S$ by $B$, see
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme}.
Thus we may assume $S = B$.

\medskip\noindent
Assume $S = B$. Choose an affine open covering $S = \bigcup U_i$.
Denote $\mathcal{X}_i$ the restriction of $\mathcal{X}$ to
$(\Sch/U_i)_{fppf}$. If we can find schemes $W_i$ over $U_i$ and
surjective smooth morphisms $W_i \to \mathcal{X}_i$, then we
set $W = \coprod W_i$ and we obtain a surjective smooth morphism
$W \to \mathcal{X}$. Thus we may assume $S = B$ is affine.

\medskip\noindent
Assume $S = B$ is affine, say $S = \Spec(\Lambda)$.
Write $\Lambda = \colim \Lambda_i$ as a filtered colimit with each $\Lambda_i$
of finite type over $\mathbf{Z}$. For some $i$ we can find
a morphism of algebraic spaces $X_i \to \Spec(\Lambda_i)$
which is proper, flat, of finite presentation and whose base change
to $\Lambda$ is $X$. See Limits of Spaces, Lemmas
\ref{spaces-limits-lemma-descend-finite-presentation},
\ref{spaces-limits-lemma-descend-flat}, and
\ref{spaces-limits-lemma-eventually-proper}.
If we show that $\Complexesstack_{X_i/\Spec(\Lambda_i)}$ is an
algebraic stack, then it follows by base change
(Remark \ref{remark-complexes-base-change} and
Algebraic Stacks, Section \ref{algebraic-section-change-base-scheme})
that $\mathcal{X}$ is an algebraic stack.
Thus we may assume that $\Lambda$ is a finite type $\mathbf{Z}$-algebra.

\medskip\noindent
Assume $S = B = \Spec(\Lambda)$ is affine of finite type over $\mathbf{Z}$.
In this case we will verify conditions (1), (2), (3), (4), and (5) of
Artin's Axioms, Lemma \ref{artin-lemma-diagonal-representable}
to conclude that $\mathcal{X}$ is an algebraic stack.
Note that $\Lambda$ is a G-ring, see
More on Algebra, Proposition \ref{more-algebra-proposition-ubiquity-G-ring}.
Hence all local rings of $S$ are G-rings. Thus (5) holds.
To check (2) we have to verify axioms [-1], [0], [1], [2], and [3]
of Artin's Axioms, Section \ref{artin-section-axioms}.
We omit the verification of [-1] and axioms
[0], [1], [2], [3] correspond respectively to
Lemmas \ref{lemma-complexes-stack},
\ref{lemma-complexes-limits},
\ref{lemma-complexes-RS-star},
\ref{lemma-complexes-tangent-space}.
Condition (3) follows from Lemma \ref{lemma-complexes-strong-effectiveness}.
Condition (1) is Lemma \ref{lemma-complexes-diagonal}.

\medskip\noindent
It remains to show condition (4) which is openness of versality.
To see this we will use
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.
We have already seen that $\mathcal{X}$ has diagonal
representable by algebraic spaces, has (RS*), and is limit preserving
(see lemmas used above).
Hence we only need to see that $\mathcal{X}$ satisfies the strong
formal effectiveness formulated in
Artin's Axioms, Lemma \ref{artin-lemma-SGE-implies-openness-versality}.
This follows from Lemma \ref{lemma-complexes-strong-effectiveness}
and the proof is complete.
\end{proof}











\input{chapters}

\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
